77
rated 0 times
[
84]
[
7]
/ answers: 1 / hits: 28339
/ 13 Years ago, thu, august 18, 2011, 12:00:00
In Javascript is there any difference between these two ways of adding a function to an object? Is one preferable for any reason?
function ObjA() {
this.AlertA = function() { alert(A); };
}
ObjA.prototype.AlertB = function() { alert(B); };
var A = new ObjA();
A.AlertA();
A.AlertB();
More From » javascript