I have two functions. One is normal function and one is arrow function inside an object. Inside the arrow function I want to access the inner Name and global name.
const name = "globalname";
const obj = {
name: 'john G',
regularFunction: function() {
setTimeout(() => {
console.log('from Regular Function ', this.name)
}, 100);
},
arrowFunction: () => {
setTimeout(() => {
console.log('from Arrow Function: ' + this.name) //here want to access the global name and object level name variable.
}, 200)
}
}
obj.regularFunction();
obj.arrowFunction();