Here描述了如何使用Firebug / FF Web控制台检查innerHTML
属性是否可配置和可枚举。
如何查看charCodeAt
函数的相同内容? Object.getOwnPropertyDescriptor(HTMLElement.prototype,"charCodeAt")
返回undefined
。
答案 0 :(得分:4)
.charCodeAt()
method属于Strings,而不属于HTMLElement
:
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")
答案 1 :(得分:2)
这是因为charCodeAt
不是HTMLElement
的方法,它是String
- 对象(或者更确切地说是原型)中的方法
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")