Standard built-ins

String.prototype.codePointAt()

Try the free JavaScript compiler

Returns the code point starting at the index, combining a valid leading/trailing surrogate pair. A lone or trailing surrogate is returned as its unit number.

Formal Syntax & Structure

javascript syntaxjavascript
text.codePointAt(index)

Parameters & Attributes

NameTypeDescription
indexNumberIndex converted to an integer.

Return Value

Number | undefined

Code point number or undefined.

Working Example

Example Snippetjavascript
console.log("😀".codePointAt(0));
JavaScript Reference