CoffeeScriptRedux icon indicating copy to clipboard operation
CoffeeScriptRedux copied to clipboard

Unexpected ','

Open mirek opened this issue 9 years ago • 3 comments

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.

mirek avatar Jul 07 '14 16:07 mirek

+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...

provegard avatar Aug 29 '14 06:08 provegard

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 

forivall avatar Aug 30 '14 01:08 forivall

that just looks so weird and odd. the lonesome comma looks only slightly less weird though

eddiemonge avatar Oct 10 '14 21:10 eddiemonge