【发布时间】:2012-12-07 08:49:55
【问题描述】:
我从 grunt npm 模块的源代码中看到以下代码行 -
String.prototype.__defineGetter__(method, function() { return this; });
只是试图预测上面匿名函数中“this”的值 -
- 它指向“方法”
- 全局“窗口”对象,如果在浏览器中运行,或者从 grunt 的角度来看类似的东西
- 如果在“defineGetter”定义中使用了调用或应用,则其他内容取决于 defineGetter 的定义。
感谢您的帮助!!
【问题讨论】:
-
因为
console.log()是2011年?
标签: javascript scope this npm anonymous-function