JS Built-ins
StringString.prototype.codePointAtbeginner

String.prototype.codePointAt() β€” basic ASCII

πŸ“– 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()

str.codePointAt(pos) returns the Unicode code point value at the given position. For BMP characters it works just like .charCodeAt().

Challenge: Implement getCodePoint(str, pos) using .codePointAt().

getCodePoint('A', 0) // β†’ 65
getCodePoint('a', 0) // β†’ 97
πŸ’‘ Hints (1)
  • β€’ For BMP characters (code points ≀ 65535), `.codePointAt()` returns the same value as `.charCodeAt()`.