- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript String Escape Characters
JavaScript Strings
JavaScript String Escape Characters
A backslash lets you put special characters inside a string.
Some characters cannot be typed directly inside quotes.
The backslash tells JavaScript to treat the next character specially.
Example
Example
javascript
const text = "She said \"hello\"";
console.log(text);The quotes appear as part of the text.
The Common Escapes
\n is a new line and \t is a tab.
\" and \' are quotes.
\\ is a single backslash.
