Same code but getting access error on one code block.
//Getting undefined error
//output: Hi Mark, my name is undefined
var john = {
sProp: 'John',
greet: function(person) {
alert("Hi " + person + ", my name is " + this.sProp);
}
};
var fx = john.greet;
fx("Mark");
// no undefined error
// output is " Say hito allsome string value "
var myObject = {
sProp: 'some string value',
numProp: 2,
callme:function(arg){
alert("Say hi" + arg + this.sProp);
}
};
myObject.callme('to all');