this keyword in javascript
This page neatly explains about “this” keyword
http://www.quirksmode.org/js/this.html
From javascript object oriented programming concepts - http://www.sitepoint.com/oriented-programming-1-2 The this keyword inside a constructor function refers to the object that’s being created.
Quoting below example from SitePoint.com
function myFunc(StringValue) {
this.StringValue = StringValue;
}
var myObject = new myFunc("This is myObject's string");
var myObject2 = new myFunc("This is a String");
alert(myObject.StringValue); // displays "This is myObject's string"
alert(myObject2.StringValue); // displays "This is a String"
Categories :
JavaScript