Syntax of CoffeeScript – Easy to use – Easy to Read
Here I am showing some example.
str = "CoffeeScript"
square = (x) -> x * x
string = "Passed" if condition
4. Multiply numbers with 2
[1..10].map (i) -> i*2
math = root: Math.sqrt square: square cube: (x) -> x * square x
eat food for food in ['toast', 'cheese', 'wine']
npm install -g coffee-script
(Leave off the -g if you don’t wish to install globally.)
If you’d prefer to install the latest master version of CoffeeScript, you can clone the CoffeeScriptsource repository from GitHub, or download the source directly. To install the lastest master CoffeeScript compiler with npm:
npm install -g http://github.com/jashkenas/coffee-script/tarball/master
Or, if you want to install to /usr/local, and don’t want to use npm to manage it, open the coffee-script directory and run:
sudo bin/cake install
For More Information and learning