admin管理员组文章数量:1316523
I get this error in the javascript debug panel when trying to call String.charCodeAt('9') in Safari 3.
TypeError: Result of expression 'String.charCodeAt' [undefined] is not a function.
When I try to do stringInstance.charCodeAt('9') instead, I get NaN. Am I doing something wrong? I'd just like to get the char code for some characters to match against keypresses. String.charCodeAt('9') returns 57 (as expected) on Firefox.
I get this error in the javascript debug panel when trying to call String.charCodeAt('9') in Safari 3.
TypeError: Result of expression 'String.charCodeAt' [undefined] is not a function.
When I try to do stringInstance.charCodeAt('9') instead, I get NaN. Am I doing something wrong? I'd just like to get the char code for some characters to match against keypresses. String.charCodeAt('9') returns 57 (as expected) on Firefox.
Share Improve this question asked Oct 9, 2009 at 6:32 readonlyreadonly 356k109 gold badges206 silver badges206 bronze badges1 Answer
Reset to default 5I think the proper way is:
"9".charCodeAt(0)
or stringInstace.charCodeAt(charIndex) where charIndex is an integer
本文标签: javascriptStringcharCodeAt undefinedStack Overflow
版权声明:本文标题:javascript - String.charCodeAt undefined? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742004789a2411739.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论