Explain this: var Bob = { name: "Bob", name_fn: function(){ return this.name; } } console.log(Bob.name_fn()) //"Bob" var fn = Bob.name_fn console.log(fn()) //undefined
Sigiloso
when you call fn() its scope is in global. The function call should be scoped properly to work. You should use call or apply to make it work.