StringprototypecodePointAt0
String.prototype.codePointAt(0) refers to the JavaScript String method that returns the numeric Unicode code point at the first position of a string. It is similar in purpose to charCodeAt but differs in how it handles characters that are represented by surrogate pairs in UTF-16. When used with 0, the method will return the full code point for a character that starts at the first position if that character is encoded as a surrogate pair.
The argument pos is converted to an integer. If pos is negative or greater than or equal
Examples help illustrate the behavior. For a simple ASCII string like "A", "A".codePointAt(0) yields 65. For a
Edge cases include strings starting with a lone high surrogate (not followed by a low surrogate), where
See also: String.prototype.charCodeAt, Unicode code points, surrogate pairs.