The following code:
var cody = {
living:true,
age:23,
gender:'male',
getGender:function(){return cody.gender;}
};
is the same as :
var cody = {
living:true,
age:23,
gender:'male',
getGender:function(){return this.gender;}
};
Both codes acheive the same target. The only difference is the swap of cody with the keyword this. What is the benefits of using the keyword this in Javascript? Does it boost the performance? can we ignore it in OOP?