---
source: crates/oxc_linter/src/tester.rs
---
  ⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
   ╭─[bad_char_at_comparison.tsx:1:1]
 1 │ a.charAt(4) === 'aa'
   · ─────┬─────     ──┬─
   ·      │            ╰── And compared with a string of length 2 here
   ·      ╰── `charAt` called here
   ╰────
  help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.

  ⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
   ╭─[bad_char_at_comparison.tsx:1:1]
 1 │ a.charAt(4) === '/n'
   · ─────┬─────     ──┬─
   ·      │            ╰── And compared with a string of length 2 here
   ·      ╰── `charAt` called here
   ╰────
  help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.

  ⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
   ╭─[bad_char_at_comparison.tsx:1:1]
 1 │ a.charAt(3) === '/t'
   · ─────┬─────     ──┬─
   ·      │            ╰── And compared with a string of length 2 here
   ·      ╰── `charAt` called here
   ╰────
  help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.

  ⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
   ╭─[bad_char_at_comparison.tsx:1:1]
 1 │ a.charAt(4) === 'ac'
   · ─────┬─────     ──┬─
   ·      │            ╰── And compared with a string of length 2 here
   ·      ╰── `charAt` called here
   ╰────
  help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.

  ⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
   ╭─[bad_char_at_comparison.tsx:1:1]
 1 │ a.charAt(822) !== 'foo'
   · ──────┬──────     ──┬──
   ·       │             ╰── And compared with a string of length 3 here
   ·       ╰── `charAt` called here
   ╰────
  help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.

  ⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
   ╭─[bad_char_at_comparison.tsx:1:1]
 1 │ a.charAt(4) === '\\ukeff'
   · ─────┬─────     ────┬────
   ·      │              ╰── And compared with a string of length 6 here
   ·      ╰── `charAt` called here
   ╰────
  help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.
