Thursday, March 1, 2012

Javascript Prototyping

// the class
var MyClass = function() {
     var oThis = this;

     this.member1 = 'adrian';

     this.fnSetterMethod1 = function(o) {
           oThis.member1 = o;
     };

};

// initializing an object

var obj = new MyClass();

// invoking a method
obj.fnSetterMethod1('new value');