Below is the code , the code is working as expected if the function is usual function but it is not working with the arrow and anonymous function.But i am interested why it is not working so in case of arrow and anonymous function.
var testObj={
name:"Shivendra",
age:22,
summary:function(){
console.log(`His name is ${this.name} and he is ${this.age} years old {Summary}`)
},
summary2: ()=>{
console.log(`His name is ${this.name} and he is ${this.age} years old {Summary2}`)
},
summary3:function(){
var nestedAnonymousFunction=function(){
console.log(`His name is ${this.name} and he is ${this.age} years old{Summary3} `)
}
nestedAnonymousFunction();
}
}
testObj.summary();
testObj.summary2();
testObj.summary3();