摘要:
在javascript中,函数总是在一个特殊的上下文执行(称为执行上下文),如果你将一个对象的函数赋值给另外一个变量的话,这个函数的执行上下文就变为这个变量的上下文了。下面的一个例子能很好的说明这个问题。window.name = "the window object"function scopeTest() { return this.name;}// calling the function in global scope:scopeTest()// -> "the window object"var foo = { name: "t 阅读全文