Escape Sequences
An escape sequence in created using a backslash to identify the special character.
JavaScript supports the following escape sequences:
|
Escape Sequence |
Description |
|---|---|
|
\’ |
Single quote or apostrophe |
|
\” |
Double quote |
|
\\ |
Backslash |
|
\0 |
Null character (that is backslash plus zero) |
|
\b |
Backspace |
|
\f |
Form feed |
|
\n |
New line |
|
\r |
Carriage return |
|
\t |
Horizontal tab |
|
\v |
Vertical tab |
|
\xXX |
Latin-1 character specified by two hexadecimal digits. For example, the copyright symbol its \xa9 |
|
\uXXXX |
Unicode character specified by four hexadecimal digits. For example, the π symbol is \u03c0. |
Note:
If you include the backslash in front of any other character than those shown in the table, JavaScript will ignore the backslash.