4 ms·
An other good example is constructors; say you have a function like this: function MyClass(x){ this.x = x; } In Coffeescript this translates t
by fooyc 15y ago
An other good example is constructors; say you have a function like this:
function MyClass(x){
this.x = x;
}
In Coffeescript this translates to
MyClass = (x) ->
@x = x
`x` is returned; and if you return something from a constructor, something is returned instead of the constructed object (`new MyClass({})` returns `{}`).