2 ms·
>the difference between JavaScript and CoffeeScript with respect to the "var" keyword is neither subtle nor obvious, given that CoffeeScript does not have a var
by lmm 14y ago
>the difference between JavaScript and CoffeeScript with respect to the "var" keyword is neither subtle nor obvious, given that CoffeeScript does not have a var keyword
The thing that is subtle and nonobvious as a javascript programmer is the way CoffeeScript variables are scoped. They are not scoped like "var" variables in javascript. They are not scoped like "non-var" variables in javascript either. They have their own kind of scope that is unique to CoffeeScript.
Now you can argue that the way javascript scopes variables is wrong, and I'd agree with you. You can argue that the CoffeeScript way is better, and that's fine. But it makes it a different language from JavaScript, and it has all the baggage that goes along with that. You can't just treat CoffeeScript as "javascript with a nicer syntax"; you need to approach it the same way you'd approach learning any new language.