vendredi 20 décembre 2013

CoffeeScript instance and static variables

Courtesy of http://www.cs8.my/2012/09/coffeescript-classes-and-their-variables/

so to sum it up, in your class definition:

  • @nose: or @nose = defines a static (class) variable/function
  • nose: defines a prototype variable/function
  • nose= defines a private variable/function

in your constructor:

  • nose= defines a private variable for an instance of the class
  • @nose= defines an ‘instance’ variable for an instance of the class