charCodeAt
概要Description
签名
s.charCodeAt(index?: number): number
功能
返回 s 中索引位置是 0 或者 index 的字符的 Unicode 编码
index 超出范围时,得到NaN
广告
案例Examples
正常情况
1 2 =s = 'zzax';result = s.charCodeAt(2);97
index 参数
可以不写
那索引位置就是 0
1 2 =s = 'zzax';result = s.charCodeAt();122
超出范围
会得到NaN
1 2 =s = 'zzax';result = s.charAt(9917);NaN
广告