Escape Characters in JavaScript
Read This on Github
⭐ Escape Character
Explanation of Escape Character
In JavaScript, an escape character is a character that is used to represent a character that cannot be typed directly from the keyboard. Escape characters are typically used to specify special characters in a string, such as newlines, tabs, and quotation marks.
There are several escape characters in JavaScript that can be used in strings. Here is a list of some of the most commonly used escape characters:
| Escape Character | Description | 
|---|---|
| \' | Single quote | 
| \" | Double quote | 
| \\ | Backslash | 
| \b | Backspace | 
| \f | Form feed | 
| \n | Newline | 
| \r | Carriage return | 
| \t | Tab | 
| \v | Vertical tab | 
let str = 'This string includes all of the escape characters: \', \", \\, \b, \f, \n, \r, \t, and \v';
console.log(str);
// Output: "This string includes all of the escape characters: ', ", \, \b, \f, \n, \r, \t, and \v"The \' escape character is used to insert a single quote, the \" escape character is used to insert a double quote, the \\ escape character is used to insert a backslash, the \b escape character is used to insert a backspace, the \f escape character is used to insert a form feed, the \n escape character is used to insert a newline, the \r escape character is used to insert a carriage return, the \t escape character is used to insert a tab, and the \v escape character is used to insert a vertical tab.
