Any difference between those two in Javascript? -
using this
var class1 = function() { this.test1 = function() { }; }; and following
function class1() { }; class1.prototype.test1 = function() { }; is there difference between two?
the first 1 makes separate copy of function each class instance.
allows function use closure'd variables constructor.
Comments
Post a Comment