String.prototype.codePointAt()
The codePointAt()
method returns a non-negative integer
that is the Unicode code point value at the given position.
Note that this function does not give the nth code point in a string,
but the code point starting at the specified string index.
Syntax
codePointAt(pos)
Parameters
pos
- : Position of an element in
str
to return the code point value from.
- : Position of an element in
Return value
A decimal number representing the code point value of the character at the given pos
.
- If there is no element at
pos
, returnsundefined
. - If the element at
pos
is a UTF-16 high surrogate, returns the code point of the surrogate pair. - If the element at
pos
is a UTF-16 low surrogate, returns only the low surrogate code point.