如何检查 charCodeAt() 是否可配置

how to check if charCodeAt() is configurable

本文关键字:配置 是否 charCodeAt 检查 何检查      更新时间:2023-09-26

这里描述了如何使用Firebug/FF Web控制台检查innerHTML属性是否可配置和枚举。如何检查charCodeAt功能相同? Object.getOwnPropertyDescriptor(HTMLElement.prototype,"charCodeAt")返回undefined .

.charCodeAt() 方法属于字符串,而不是HTMLElement

Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")

这是因为charCodeAt不是一种HTMLElement的方法,它是String中的一种方法 -Object(或者更确切地说是它的原型)

Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")