摘要: 在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 阅读全文
posted @ 2011-12-26 12:45 pingjiang 阅读(1776) 评论(1) 推荐(1) 编辑
点击右上角即可分享
微信分享提示