JS Built-ins
StringString.prototype.codePointAtadvanced

String.prototype.codePointAt() β€” surrogate at position 1

πŸ“– 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() β€” Surrogate Position

An emoji stored as a surrogate pair occupies positions 0 and 1. .codePointAt(1) returns the low surrogate code unit.

Challenge: Implement lowSurrogate() that returns the code point of 'πŸ˜€' at position 1 (the low surrogate).

lowSurrogate() // β†’ 56832  (0xDE00)
πŸ’‘ Hints (1)
  • β€’ Low surrogates are in the range 0xDC00–0xDFFF (56320–57343).