"this" in JavaScript = a referral to the parent object
TEST IT:
http://www.w3schools.com/js/tryit.asp?filename=tryjs_create_object2
adding & removing "this" was the easiest way for me to understand
EXAMPLE:
"this" is a replacement of OpenStudioModel function
"this" is the current instance of OpenStudioModel
"this" is adding functionality to OpenStudioModel function
"this" is short hand for OpenStudioModel.model & OpenStudioModel.runManager
TEST IT:
http://www.w3schools.com/js/tryit.asp?filename=tryjs_create_object2
adding & removing "this" was the easiest way for me to understand
EXAMPLE:
function OpenStudioModel(buildingData, runmanager) {this.model = new openstudio.model.Model();this.runManager = runmanager;};
"this" is a replacement of OpenStudioModel function
"this" is the current instance of OpenStudioModel
"this" is adding functionality to OpenStudioModel function
"this" is short hand for OpenStudioModel.model & OpenStudioModel.runManager
REFERENCES
CodeSchool Definition of "this": this keyword will automatically refer to the new instance of the class that is being made