Microsoft Dynamics Developer
Showing posts with label
Javascript
.
Show all posts
Showing posts with label
Javascript
.
Show all posts
Saturday, 21 April 2012
Javascript Prototypes
//Dynamically add method in class using Prototypes
//Define Class
function Foo()
{
this.x = 1;
}
//Add the new method in class
Foo.prototype.AddX = function(y)
{
this.x += y;
}
obj = new Foo;
obj.AddX(5); //call method
Older Posts
Home
Subscribe to:
Posts (Atom)