Switch example from coffeescript to js