JS Built-ins
StringString.prototype.charCodeAtbeginner

String.prototype.charCodeAt() β€” code of second 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() β€” Second Character

Challenge: Implement secondCharCode(str) that returns the char code of the character at index 1.

secondCharCode('hello') // β†’ 101  ('e')
secondCharCode('AB')    // β†’ 66   ('B')
πŸ’‘ Hints (1)
  • β€’ `str.charCodeAt(1)` is the code of the second character.