跳至主要內容

String.prototype.codePoints

小于 1 分钟featurees-proposal

String.prototype.codePointsopen in new window

模块

esnext.string.code-pointsopen in new window

类型

interface String {
  codePoints(): Iterator<{ codePoint: number; position: number }>;
}

入口点

core-js/proposals/string-code-points
core-js(-pure)/full/string/code-points

示例

示例open in new window:

for (let { codePoint, position } of "qwe".codePoints()) {
  console.log(codePoint); // => 113, 119, 101
  console.log(position); // => 0, 1, 2
}