I have class
function Foo(a) {
this.a = a;
this.bar = function () {
console.log(this.a);
};
this.buz = function () {
this.a();
console.log('bzz');
};
}
and I'll have quite many instances of this class. Should I move methods to prototype?
function Foo(a) {
this.a = a;
}
Foo.prototype = {
bar: function () {
console.log(this.a);
},
buz: function () {
this.a();
console.log('bzz');
}
}