coffeescript Classes Prototypes


Example

If you feel the need to extend an object's prototype, :: gives you quick access to an it so you can add methods to it and later use this method on all instances of that method.

String::dasherize = ->
  this.replace /_/g, "-"

The above example will give you the ability to use the dasherize method on all Strings. This will replace all underscores to dashes.