JS Built-ins
StringString.prototype.codePointAtbeginner

String.prototype.codePointAt() β€” undefined for out-of-bounds

πŸ“– 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() β€” Out-of-Bounds

Like .at(), .codePointAt() returns undefined when the index is out of range.

Challenge: Implement isValidPos(str, pos) that returns true when str.codePointAt(pos) is not undefined.

isValidPos('hi', 0) // β†’ true
isValidPos('hi', 5) // β†’ false
πŸ’‘ Hints (1)
  • β€’ `.codePointAt()` returns `undefined` for out-of-range indices.