CoffeeScript is a programming language that transcompiles to JavaScript. The language adds syntactic sugar inspired by Ruby, Python and Haskell to enhance JavaScript's brevity and readability, adding sophisticated features like list comprehension and pattern matching. CoffeeScript compiles predictably to JavaScript and programs can be written with less code, typically 1/3 fewer lines, with no effect on runtime performance. Since March 16, 2011, CoffeeScript has been on GitHub's list of most-watched projects, and as of today is the eleventh most popular language on GitHub.
...Additionally, Brendan Eich has referenced CoffeeScript as an influence on his thoughts about the future of JavaScript.
-- Wikipedia
[terrence_lee@BAM-024206-TL~]$ npm install -g coffee-script
# Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x # Splats: race = (winner, runners...) -> print winner, runners # Existence: alert "I knew it!" if elvis? # Array comprehensions: cubes = (math.cube num for num in list) # Class, Inheritance, and Super class Animal constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." class Snake extends Animal move: -> alert "Slithering..." super 5 class Horse extends Animal move: -> alert "Galloping..." super 45 #Lexical Scooping and Variable Safety outer = 1 changeNumbers = -> inner = -1 outer = 10 inner = changeNumbers() # Eat lunch. eat food for food in ['toast', 'cheese', 'wine'] # Fine five course dining. courses = ['greens', 'caviar', 'truffles', 'roast', 'cake'] menu i + 1, dish for dish, i in courses # Health conscious meal. foods = ['broccoli', 'spinach', 'chocolate'] eat food for food in foods when food isnt 'chocolate' # Interpolation ages = for child, age of yearsOld "#{child} is #{age}" # Exisential Operator zip = lottery.drawWinner?().address?.zipcode