String.prototype.codePoints
小于 1 分钟
String.prototype.codePoints
模块
类型
interface String {
codePoints(): Iterator<{ codePoint: number; position: number }>;
}
入口点
core-js/proposals/string-code-points
core-js(-pure)/full/string/code-points
示例
示例:
for (let { codePoint, position } of "qwe".codePoints()) {
console.log(codePoint); // => 113, 119, 101
console.log(position); // => 0, 1, 2
}