I have the following code . I expected it to
- Print the person object within UnBoundFx as it is set in the bind method
- The final person.name to print "changed name"
But actually it prints undefined and the actual name "test" Can you please help me understand what i am missing from understanding how bind words?
let person ={
name:"test",
getStr: ()=>{
console.log(person.name)
}
}
let unBoundFx = ()=>{
console.log(this)
this.name = "changed name";
}
let boundFx = unBoundFx.bind(person)
boundFx()
console.log(person.name)