DEV Community

Discussion on: The tale of three dots in Javascript

Collapse
 
danielo515 profile image
Daniel Rodríguez Rivero

I was about to say the same. What he wrote is just wrong syntax. I may work if it is compiled to regular function, but in a native implementation it will not work.

Collapse
 
sonicoder profile image
Gábor Soós

It is just old, not wrong, still runs in Chrome. Bad syntax would be non backward compatible breaking change.

Thread Thread
 
danielo515 profile image
Daniel Rodríguez Rivero

It is not just old, is wrong. You can of course declare such function because the permissive nature of javascript, but if you try to run it you are going to get an error because arguments is an undefined variable. You can see it yourself in the (hopefully) attached screenshot.
But you don't have to trust me, is on the spec: developer.mozilla.org/en-US/docs/W...

Thread Thread
 
sonicoder profile image
Gábor Soós

I had a misunderstanding here, thanks for linking the documentation

Thread Thread
 
danielo515 profile image
Daniel Rodríguez Rivero

No problem. JS is a tricky language (sometimes 😄).