What are javascript prototypes? (short answer for advanced javascripters)

[I've also written a longer answer for beginners] 

Prototypes can extend any class you want by adding a property or a method. By calling,

[source:javascript]
String.prototype.alertMe = function() {
alert(this);
}
[/source]

you are adding the method alertMe() to every String object of your application.

It uses less memory because javascript creates only one instance of the function and uses references to it.

Short answer done!

  • http://kalzggdjsdcvi.com/ dYcxcgcvfgg

    2011…

    Pretty nice post. I just stumbled upon your blog and wished to say that I have really enjoyed browsing your blog posts. In any case I will be subscribing to your rss feed and I hope you write again soon!…

  • http://esoftwarereview.info software reviews

    2011…

    Thanks for sharing superb informations. Your site is so cool. I am impressed by the details that you’ve on this site. It reveals how nicely you understand this subject. Bookmarked this website page, will come back for extra articles. You, my pal, ROCK!…

  • http://www.sportspicksnation.com picks for college football

    2011…

    This blog is definitely rather handy since I’m at the moment creating an internet floral website – although I am only starting out therefore it’s really fairly small, nothing like this site. Can link to a few of the posts here as they are quite. Thanks…