if opposite square = (x) -> x * x list = [1, 2, 3, 4, 5] math = root: Math.sqrt square: square cube: (x) -> x * square x race = (winner, runners...) -> print winner, runners alert "I knew it!" if elvis?
= -1 outer = 10 var changeNumbers, inner, outer; outer = 1; changeNumbers = function() { var inner; inner = -1; return outer = 10; }; You never need to write var yourself. CoffeeScript JavaScript
is yes checked is no value is on value is off admin === true admin === false checked === true checked === false value === true value === false CoffeeScript JavaScript More ways to say what you mean.
are the same. person = name: "Joe", age: 39 {name: name, age: age} = person # the above is shorthand for {name, age} = person # name = “Joe” # age = 39
alert @.attr("href") # you can omit the dot $("a").on "click", -> alert @attr("href") alert(this.attr("href")) alert(this.attr("href")) CoffeeScript JavaScript @ this