JavaScript - String codePointAt() method example

0 points
Created by:
// ONLINE-RUNNER:browser;

var text = 'π★🍎';

console.log(text.codePointAt(0)); // 960
console.log(text.codePointAt(1)); // 9733
console.log(text.codePointAt(2)); // 127822


SyntaxString codePointAt(index)
Parametersindex - position of an element in the string

A decimal number representing the code point value of the character at the given index.

If there's no element at the given index, the method returns undefined.

DescriptionThe codePointAt() method is used to return a non-negative integer that is the unicode code point value at the given position.


  1. String.prototype.codePointAt() - JavaScript | MDN

Alternative titles

  1. JavaScript - String.prototype.codePointAt() documentation with examples
  2. js - String codePointAt() method documentation with examples
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript - String (documentation)

Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂