Saturday, February 11, 2012

Prototypes and 'new' statement in Javascript

The blog is now moved here

The purpose of this article is to be a reminder how prototypes in javascript works. It is not full manual or detailed guide how to deal with that. So let's get started.

Classes in javascript is simply functions. Let's create few
var A = function(){
    this.some = 'A value';
    this.another = 'A value another';
}
Now we have two functions which can be be instantiated with new keyword
var a = new A();