首页 > 开发 > JS > 正文

关于js中charCodeAt()

2017-09-05 05:51:27  来源:网友分享

在for循环中

nums[i].charCodeAt() //正确输出asciinums[i+1].charCodeAt()  //TypeError: Cannot read property 'charCodeAt' of undefined

不是很明白其中的原理,求解释一下

解决方案

数组越界了吧