Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var x = {
name:'Steve',
hello:function(){
var that = this;
var helper = function(){
console.log('X Name ',that.name);
};
helper();
}
};
var y = {
name:'Steve',
hello:function(){
var helper = function(){
console.log('Y Name ' ,this.name);
}.bind(this);
helper();
}
};
var z = {
name:'Steve',
hello:function(){
var helper =()=>{
console.log('Z Name ',this.name);
}
helper();
}
};
x.hello();
y.hello();
z.hello()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment