Tems: Prototype

Hello again children. Today we are going to learn about a nifty little property in Javascript - PROTOTYPE.

First off, have you ever worked with objects in Javascript? Tell me about it in the comments if you have. There is some debate over whether Javascript is truly an object oriented programming language or not (see here: http://javascript.crockford.com/javascript.html to learn why we tend to underestimate this language.) Either way, the prototype property is meant for working with javascript objects. Since I don't really know much about Object Oriented programming myself (which I plan to soon change!), I can't honestly give you a full run down on what it means/does. I'm just going to tell you the gist and give you the link so you can read for yourself.

Basically the idea is by using someObject.prototype.someMethodOrValue = something, you are in fact assigning that method or value to all instances of this object.

I have a hunch that this little feature may be at the heart of what makes JS object oriented. But I think I'll have to get back to you on that once I actually KNOW something about it. In the meantime, read about it for yourself.

Ta ta for now!

0 comments:

Post a Comment