function foo(){ console.log(this.name) } var name = 'window'; var obj = { name:'obj', foo:foo } // foo() // foo.call(obj) obj.foo()