For instance, consider the code snippet :
var john=
{ fullname: 'john smith',
bill:[124,48,268,180,42],
tip:[],final:[],
calcTip:function()
{
for(var i =0;i<this.bill.length;i++)
{
if(this.bill[i]<50)
this.tip[i]=0.2*this.bill[i];
else
this.tip[i]=0.1*this.bill[i];
this.final[i]=this.tip[i]+this.bill[i];
}
}
};
I tried skipping the usage of 'this' to access array members of bill and this was the output that it produced :
Uncaught ReferenceError: bill is not defined