Skip to content

Files

Latest commit

 

History

History
21 lines (15 loc) · 457 Bytes

no-hex-escape.md

File metadata and controls

21 lines (15 loc) · 457 Bytes

Pattern: Hexadecimal escape sequence in string

Issue: -

Description

Using hexadecimal escape sequences (\x) makes code less consistent and harder to understand. Unicode escapes (\u) should be used instead for better clarity and consistency.

Examples

Example of incorrect code:

const foo = "\x1B";
const foo = `\x1B${bar}`;

Example of correct code:

const foo = "\u001B";
const foo = `\u001B${bar}`;