Visit Mozilla.org

Talk:Introduction to Object-Oriented JavaScript

From MDC

Nice job improving my article, i wanna thank everyone helping and correcting the article to improve it.

Drop a line to leave your comments on My talk section for user Trasvina tanks a lot all.


[edit] Inheritance example is foobar

Because Student.prototype is set to Person.prototype, any changes made to Student also affect Person.

var person1 = new Person('Male')  // Person instantiated   -- OK
person1.sayHello()                // hi, I am a student    -- NOT 'hello' as expected

So sayHello() has been redefined for both classes. This isn't inheritance. --Hamstersoup 22:13, 13 May 2007 (PDT)