3 ms·
From github: CoffeeScript: number = -42 if opposite Javascript: if (opposite) number = -42; How is coffeescript an advantage in this example? The javascript
by grannyg00se 15y ago
From github:
CoffeeScript:
number = -42 if opposite
Javascript:
if (opposite) number = -42;
How is coffeescript an advantage in this example? The javascript seems more readable to me as it more closely follows regular english grammar.
CoffeeScript:
square = (x) -> x * x
Javascript:
square = function(x) {
return x * x;
}
In this example, again the javascript seems more clear. The function actually has the word function in the declaration. I like that. Essentially coffeescript took out the word 'function' and 'return' and replaced curly braces with other symbols.
- donpark 15y agoCoffeeScript is one of those things that one has to actually try to feel the full impact. Use it for a few days then return to javascript.
- stephth 15y agoInline conditionals on the left and the function keyword? From all the features that CoffeeScript offers it's kinda odd to focus on those minor details of taste and habit.
- grannyg00se 15y agoBut it's one of the first things that is presented on the overview so naturally it's going to get lots of focus.
- stdbrouw 15y agoIt's a bloody overview mate, it mentions everything in more-or-less random order :-)
- endtime 15y agoYou can write it either way in CS. Anyway, saying that CS is a huge improvement over JS doesn't imply that every single feature of CS is better than its JS counterpart.