classes
, CoffeeScript provides a shortcut for working with prototypes
. The ::
operator gives you quick access to an object’s prototype :String::dasherize = ->
this.replace /_/g, "-"
​
String.prototype.dasherize = function() {
return this.replace(/_/g, "-");
};