【发布时间】:2012-06-29 09:13:14
【问题描述】:
我试图研究 jQuery 代码,所以我使用了这个:
document.write($.constructor);
我得到了这个结果:
function Function() { [native code] }
[native code] 是什么意思?为什么看不到真实代码?
用Google-Chrome 测试
【问题讨论】:
-
@RobW。嗯,确实如此,但我仍然不明白为什么我会得到这个值? jQuery ctor 怎么能不在 js 中? (知道
constructor是 js 与其他所有语言都不一样)源代码中没有 C\C++... -
它正在返回一个函数。在 alert() 中查看它
-
@AlexW。就像我的问题说的......?!
-
可能
constructor方法继承自JS对象,这是浏览器基本功能的一部分。
标签: javascript jquery native-code