Converting coffee script to javascript