CoffeeScriptRedux
CoffeeScriptRedux copied to clipboard
Unexpected ','
setInterval ->
console.log new Date
, 1000
gives an error:
Syntax error on line 4, column 0: unexpected ',' (\u002C)
1 :
2 : setInterval ->
3 : console.log new Date
4 : , 1000
^ :~^
5 :
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
+1
I have a lot of code exactly like this. AFAIK this is the only way to specify arguments after a function argument, unless you define the function separately and then put all arguments on one line...
The alternative (and I do this, even though I'm only targetting coffee1), is to surround the function with parens:
setInterval (->
console.log new Date()
), 1000
that just looks so weird and odd. the lonesome comma looks only slightly less weird though