Calling functions
Function invocation can look very familiar in CoffeeScript:
console.log("Hello, planet!")
Other than the missing semicolon, that's exactly like JavaScript, right? But function invocation can also look different:
console.log "Hello, planet!"
Whoa! Now we're in unfamiliar ground. This will work exactly the same as the previous example, though. Any time you call a function with arguments, the parentheses are optional. This also works with more than one argument:
Math.pow 2, 3
While you might be a little nervous writing this way at first, I encourage you to try it and give yourself time to become comfortable with it. Idiomatic CoffeeScript style eliminates parentheses whenever it's sensible to do so. What do I mean by "sensible"? Well, imagine you're reading your code for the first time, and ask yourself which style makes it easiest to comprehend. Usually it's most readable without parentheses, but there are some occasions when your code is complex enough that judicious use of parentheses...