I am new to javascript and I started with something where I am stuck in some basics, the thing is, I try to create a prototype for an object and then reference the created objects in an array and then join their methods, but I I'm mistaken somewhere, can someone help me with this, what I'm doing is shown here: -
function Obj(n){ var name=n; } Obj.prototype.disp = function(){ alert(this.name); }; var l1=new Obj("one"); var l2=new Obj("two"); var lessons=[l1,l2];
but none of these methods work ... :(
source share