Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  22] [ 1]  / answers: 1 / hits: 17919  / 16 Years ago, thu, february 12, 2009, 12:00:00

I've:



function Obj1(param)
{
this.test1 = param || 1;

}

function Obj2(param, par)
{
this.test2 = param;

}


now when I do:



Obj2.prototype = new Obj1(44);
var obj = new Obj2(55);

alert(obj.constructor)


I have:



function Obj1(param) {
this.test1 = param || 1;
}


but the constructor function has been Obj2... why that?
Obj1 has become the Obj2 prototype...



Can someone explain me, in detail, the prototype chain and the constructor property



Thanks


More From » prototype

 Answers
There are no answers for this question yet.
Only authorized users can answer the question. Please sign in first, or register a free account.
daijab

Total Points: 60
Total Questions: 99
Total Answers: 110

Location: Bosnia and Herzegovina
Member since Thu, Jun 24, 2021
3 Years ago
;