PDA

View Full Version : Inheritance in js(JavaScript) - prototype



lse123
11-12-2012, 09:23 PM
A)is used for
1) Inheritance in js(JavaScript)? Is this the ONLY way of Inheritance in js?
derivedObj.prototype = new BaseObj();
or
2)adding properties/methods to an object, that added to Contractor of this obj?
in this case old objects that already instantiated will have as null this property?

B)prototype property used for anything else in HTML5 TECHNOLOGIES?

Nile
11-13-2012, 11:03 PM
I'd suggest taking a look at Crockford's page on "Classical Inheritance in Javascript"

http://www.crockford.com/javascript/inheritance.html