Access & Inspect
Use these methods to read characters or compare strings without changing them.
They are ideal for parsing, validation, and quick checks.
- at(index): read a character (supports negative indexes). Example: `'JavaScript'.at(-1) // 't'`
- charAt(index): character at a position. Example: `'code'.charAt(1) // 'o'`
- charCodeAt(index): UTF-16 code unit. Example: `'A'.charCodeAt(0) // 65`
- codePointAt(index): full Unicode code point. Example: `'💖'.codePointAt(0) // 128150`
- localeCompare(other): compare for sorting. Example: `'a'.localeCompare('b') // -1`
- toString() / valueOf(): return string value (rarely needed, but available).