Page 1 of 1

prototype object of JavaScript ?

Posted: Sun Sep 16, 2012 9:48 am
by Live24x7
What is prototype in Javascript?

coming across code like
x.prototype.multiply()
y.prototype.min()
where and why use prototype ?
I googled for the term but couldn't make much sense of the articles.. sounded too geeky.

Would be really grateful if some one could give a simplistic explanation :roll:

Re: prototype object of JavaScript ?

Posted: Mon Sep 17, 2012 9:13 am
by social_experiment
http://helephant.com/2009/01/18/javascr ... prototype/
^ Might be useful.

Here are 2 sentences from a book about javascript that i am reading (Javascript - The definitive guide). I think this is the simplest explanation :|

Every javascript object has a second Javascript object (or null, but this is rare) associated with it. This second object is known as a prototype, and the first object inherits properties from the prototype.

Re: prototype object of JavaScript ?

Posted: Mon Sep 17, 2012 11:30 am
by Live24x7
Thanks... that is now making some sense.
Read the helephant article once-- bookmarked for a re-read.


really helpful :)