function foo(x, y) { return this.a + x + y } function log(value) { console.log(value) } function test() { log(this.a) this.fn = foo.bind(null, 1, 2) log(this.fn()) } var a = 100 var b = {a: 105, foo, test} test.call(b)