I've been writing coffeescript for a little while now and ran into something a bit peculiar.
Traditionally coffeescript declares all prototype methods individually like such:
MyClass.prototype.firstMethod = function(){...};
MyClass.prototype.secondMethod = function(){...};
However, MDN says a better way would be to do this:
(function() {
this.firstMethod = function(){...};
this.secondMethod = function(){...};
}).call(MyClass.prototype);
For the source please refer to the very end example of this page.
I was under the impression that coffeescript tries to render the best possible javascript. Is one way truly better (or possibly different) than the other or is it simply preference?
Thanks for reading!
EDIT: Seems that this question has no real answer and comes down to matter of opinion. I will leave it up for another 2 hours before deleting it. I'd like to thank everyone for their input, it helped me understand this topic better.