In JavaScript you can add special characters to a text string by using the backslash sign. JavaScript will now output the proper text string: The table below lists other special characters that can be added to a text string with the backslash sign:
Insert Special Characters
The backslash (\) is used to insert apostrophes, new lines, quotes, and other special characters into a text string.
Example:
var txt="We are the so-called \"Vikings\" from the north.";
document.write(txt);
We are the so-called "Vikings" from the north.Code Outputs \' single quote \" double quote \& ampersand \\ backslash \n new line \r carriage return \t tab \b backspace \f form feed