This is an old revision of the document!


Back Home

Basics

  • does away with all the trailing semicolons (You can still use a semicolon)
  • no curly brackets, replaced with whitespace based indentation
  • braces are options as in:
 alert 'hi there!'
  • implicit declarations, including functions, so
numbers = [0, 1, 2, 3]   // no need for var

and function declaration with '→'

square = (n) -> n * n 

// is the same as 
square = function(n) {
return n * n;
};
  • If the function has no arguments, drop the parenthesis

Javascript ..

var name, numbers;  
numbers = [0, 1, 2, 3];  
name = "NetTuts+";

much the same without the need for variable declaration

numbers = [0, 1, 2, 3]  
name = "NetTuts+" 
 
coffeescript.1363357424.txt.gz · Last modified: 2013/03/15 07:23 by admin
 
RSS - 200 © CrosswireDigitialMedia Ltd