26 lines
889 B
Plaintext

== Why is this an issue?
Octal escape sequences in string literals have been deprecated since ECMAScript 5 and should not be used in modern JavaScript code.
Many developers may not have experience with this format and may confuse it with the decimal notation.
[source,javascript]
----
let message = "Copyright \251"; // Noncompliant
----
The better way to insert special characters is to use Unicode or hexadecimal escape sequences.
[source,javascript]
----
let message1 = "Copyright \u00A9"; // unicode
let message2 = "Copyright \xA9"; // hexadecimal
----
== Resources
=== Documentation
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#string_literals[String literals]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal[SyntaxError: Octal escape sequences are deprecated]