首页 > 应用开发 > > Function原型问题
console.log(Function.prototype)
console.log(Object.prototype)
console.log((Function.prototype).hasOwnProperty("toString"))
console.log(Object.prototype.hasOwnProperty("toString"))
这四行代码在控制台上分别输出这些:
ƒ () { [native code] }
{constructor: ƒ, defineGetter: ƒ, defineSetter: ƒ, hasOwnProperty: ƒ, lookupGetter: ƒ, …}
true
true
为什么Function.prototype里面明明没有toString方法,打印的却是true
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2005/viewspace-3141597/ ,如需转载,请注明出处,否则将追究法律责任。