prototype object of JavaScript ?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

prototype object of JavaScript ?

Post 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:
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: prototype object of JavaScript ?

Post 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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: prototype object of JavaScript ?

Post by Live24x7 »

Thanks... that is now making some sense.
Read the helephant article once-- bookmarked for a re-read.


really helpful :)
Post Reply