[Prototype-core] Re: Inheritance code question

2007-09-09 Thread [EMAIL PROTECTED]
And, one thing is still very important, the object really does not have the constructor property function a(){} b=new a Object b.constructor==a true b.hasOwnProperty(constructor) false b.__proto__.constructor==a true b.__proto__.constructor a() and I really think the constructor property

[Prototype-core] Re: Inheritance code question

2007-09-08 Thread Robert Kati
When you create a new function it has a prototype property, which has a constructor property which refer to the created function: function F(){}; F.prototype.constructor === F = true So you will be able to get the class of an instance: var obj = new F; obj.constructor === F = true When we

[Prototype-core] Re: Inheritance code question

2007-09-08 Thread [EMAIL PROTECTED]
Thanks very much, and I think this constructor property is really not very reliable, such as: function a(){} a.prototype={b:123} b=new a b.constructor==Object //true and: function a(){} a.prototype=new String(aaa); b=new a; b.constructor==String you can change the constructor before or after you