JS Escape Sequences or JavaScript escape sequences
The "\" the backslash character can be used to escape.
characters.
\n outputs content to the next newline.
\r makes a return
\t makes a tab
\'outputs a single quotation mark.
\"outputs a double quotation mark.
Ex
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<html> <body> <script language="javascript"> alert("JavaScript says \"Hello World! \""); /*\" outputs a double quotation mark. */ </script> </body> </html> |
Output:
JavaScript says “Hello World!”
Explanation:
\" outputs a double quotation mark. Note that “Hello World” has a double quote with it.
