JS Built-ins
StringString.prototype.codePointAtintermediate

String.prototype.codePointAt() β€” emoji code point

πŸ“– Usage Example
const str = 'Hello'
str.codePointAt(0)     // β†’ 72
'πŸ˜€'.codePointAt(0)    // β†’ 128512

Use codePointAt() to get the full Unicode code point at a position, correctly handling supplementary characters.

String.prototype.codePointAt() β€” Supplementary Characters

For emoji and other supplementary characters, .codePointAt(0) returns the full code point (e.g. 128512 for πŸ˜€).

Challenge: Implement emojiCodePoint() that returns the code point of 'πŸ˜€' at position 0.

emojiCodePoint() // β†’ 128512
πŸ’‘ Hints (1)
  • β€’ Emoji code points are above 65535 and require a surrogate pair in UTF-16.