JS Built-ins
StringString.prototype.charCodeAtintermediate

String.prototype.charCodeAt() β€” detect digit character

πŸ“– Usage Example
const str = 'ABC'
str.charCodeAt(0)   // β†’ 65
str.charCodeAt(1)   // β†’ 66
str.charCodeAt(99)  // β†’ NaN

Use charCodeAt() to get the UTF-16 code unit value of the character at the given index.

String.prototype.charCodeAt() β€” Digit Detection

Digit characters '0'–'9' have char codes 48–57.

Challenge: Implement isDigitChar(ch) using .charCodeAt(0) to detect digit characters.

isDigitChar('5') // β†’ true
isDigitChar('a') // β†’ false
πŸ’‘ Hints (1)
  • β€’ Digit char codes: 0=48, 9=57.