Here it is described how to check if innerHTML
property is configurable and enumerable using Firebug/FF Web Console.
How can I check the same for charCodeAt
function? Object.getOwnPropertyDescriptor(HTMLElement.prototype,"charCodeAt")
return undefined
.
Asked
Active
Viewed 184 times
0
-
It says that it doesn't work in Firebug there. Make sure you are using the FF web console and not firebug – PitaJ Aug 08 '12 at 22:09
2 Answers
4
The .charCodeAt()
method belongs to Strings, not to HTMLElement
:
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")

nnnnnn
- 147,572
- 30
- 200
- 241
-
-
@amnotiam pretty sure it's in the prototype :P You are thinking `fromCharCode` – Esailija Aug 08 '12 at 22:10
-
@amnotiam - Are you sure? When I [try it out](http://jsfiddle.net/nnnnnn/7KPzq/) with `String.prototype` it works but `String` doesn't. (Testing in Chrome.) – nnnnnn Aug 08 '12 at 22:11
-
1
-
1
2
This is because charCodeAt
is not a method of HTMLElement
, it's a method in the String
-Object (or rather its prototype)
Object.getOwnPropertyDescriptor(String.prototype,"charCodeAt")

GNi33
- 4,459
- 2
- 31
- 44
-
@amnotiam it lies in the prototype, checking only on `String` returns undefined in Chrome for example – GNi33 Aug 08 '12 at 22:11