Arrow functions error - get "Error: missing ) after argument list"


#1

Hello!

When I attempt to use arrow functions in Atom, I get an error message like this:

(note: the arrow is pointing to the second “(” in case the formatting is off when I copy-pasted this)

var y = x.sort((a,b) => a-b);
^
SyntaxError: missing ) after argument list
at Object.exports.runInThisContext (vm.js:53:16)
at Object. (eval-wrapper:6:22)
at Module._compile (module.js:430:26)
at node.js:566:27
at doNTCallback0 (node.js:407:9)
at process._tickCallback (node.js:336:13)

Does anyone know how to solve this? Let me know if you need to know which packages I have installed.


#2

A great way to check CS is to plug it into the evaluator at coffeescript.org, which spits out Error on line 1: reserved word 'var' for your code. Without the var, it compiles fine.