Skip to main content

String.prototype.codePoints

Less than 1 minutefeaturees-proposal

String.prototype.codePointsopen in new window

Module

esnext.string.code-pointsopen in new window

Types

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

Entry points

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

Example

Exampleopen in new window:

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