这里描述了如何innerHTML使用 Firebug/FF Web 控制台检查属性是否可配置和可枚举。如何检查相同的charCodeAt功能?Object.getOwnPropertyDescriptor(HTMLElement.prototype,"charCodeAt")
返回undefined。
2 回答
4
该.charCodeAt()方法属于Strings,不属于HTMLElement:
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")
于 2012-08-08T22:08:16.200 回答
2
这是因为charCodeAt不是 的方法HTMLElement,它是String-Object 中的方法(或者更确切地说是它的原型)
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")
于 2012-08-08T22:09:18.380 回答