摘要: var test = { info: "hello", fn: function(){ console.log(this.info); setTimeout(arguments.callee, 1000) }}运行上面的test.fn()的时候。。第一次是可以返回"hello"的。第二次之后就返回"undefined"了,把console.log(this.info)改成console.log(this)可以发现,原因是setTimeout里面的this在第二次以后都变成指向window了。。我们的目的是让this指向test。搜了一 阅读全文
posted @ 2014-03-24 11:38 KEVIN_葉 阅读(274) 评论(0) 推荐(0) 编辑