CoffeScript compiles this:
class A
a: 'value'
to:
var A;
A = (function() {
function A() {}
A.prototype.a = 'value';
return A;
})();
What is the difference with this:
var A = function A(){};
A.prototype.a = 'value';
I tested the codes in console and the first returns function A()
, while the second returns "value"
, but as a class is intended to be instantiated, to use class A
, myA = new A()
works for both cases.