this code
class Foo
bar: []
test = new Foo()
test.bar.push('b')
test2 = new Foo()
console.log test2.bar
Will produce output ['b']
. How it is even possible?
Edit:
This is what CoffeScript generates:
// Generated by CoffeeScript 1.4.0
var Test, test, test2;
Test = (function() {
function Test() {}
Test.prototype.a = [];
return Test;
})();
test = new Test();
test.a.push('b');
test2 = new Test();
console.log(test2.a);
And therefore is exactly true what is written below. Thank you guys.