Javascript 如何检查charCodeAt()是否可配置
描述了如何使用Firebug/FF Web控制台检查Javascript 如何检查charCodeAt()是否可配置,javascript,firebug,enumerable,configurable,Javascript,Firebug,Enumerable,Configurable,描述了如何使用Firebug/FF Web控制台检查innerHTML属性是否可配置和枚举。 如何检查charCodeAt函数的相同项Object.getOwnPropertyDescriptor(HTMLElement.prototype,“charCodeAt”) 返回未定义的 属于,而不是属于HTMLElement: Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt") 属于,而不是HTMLElement: Obje
innerHTML
属性是否可配置和枚举。
如何检查charCodeAt
函数的相同项Object.getOwnPropertyDescriptor(HTMLElement.prototype,“charCodeAt”)
返回未定义的
属于,而不是属于HTMLElement
:
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")
属于,而不是HTMLElement
:
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")
这是因为
charCodeAt
不是HTMLElement
的方法,而是字符串中的方法(或者说是它的原型)
这是因为charCodeAt
不是HTMLElement
的方法,而是字符串中的方法(或者说是它的原型)
上面说它在Firebug中不起作用。确保您使用的是FF web控制台,而不是Firebug。它说它在Firebug中不起作用。请确保您使用的是FF web控制台,而不是FireBug。它直接位于字符串上,而不是字符串上。prototype
@amnotiam非常确定它位于prototype中:P您认为来自charcode
@amnotiam-您确定吗?当我使用String.prototype时,它可以工作,但是String
不能。(在Chrome上测试。)@Esailija,nnnnnn:你说得对。虽然在Firefox中,它也在String
上+1是的,那是不标准的。Firefox还添加了Array.forEach等等。它直接在String
上,而不是String.prototype
@amnotiam非常确定它在prototype中:P你想的是来自charcode
@amnotiam-你确定吗?当我使用String.prototype时,它可以工作,但是String
不能。(在Chrome上测试。)@Esailija,nnnnnn:你说得对。虽然在Firefox中,它也在String
上+1是的,那是不标准的。Firefox还添加了Array.forEach等。@amnotiam它位于原型中,只检查String
返回Chrome中未定义的example@amnotiam它位于原型中,例如,只检查String
返回Chrome中未定义的