changing coffee script to javascript