JSFiddle - React, Tailwind, and code Playground
by Zaheer Ahmed
JavaScript
var obj = {
prop: 'foo',
myFun: function() {
var that = this;
window.setTimeout(function() {
alert(that.prop);
}, 3000);
}
};
obj.myFun(); //=> *pause* foo
by Zaheer Ahmed
var obj = {
prop: 'foo',
myFun: function() {
var that = this;
window.setTimeout(function() {
alert(that.prop);
}, 3000);
}
};
obj.myFun(); //=> *pause* foo