JavaScript Special Characters

JavaScript support special characters to text string using backslash Sign(\).

Following table list are JavaScript special characters that can add to text string with the backslash sign:

JavaScript Special Characters

Special Character Description
\' single quote
\" double quote
\& ampersand
\n new line
\t tab
\\ backslash
\r carriage return
\b backspace
\f form feed
\v vertical tab
\0 null character

Note that the \v and \0 escapes are not allowed in JSON strings.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>JavaScript Special Character</title>
</head>
<body>
    <script type="text/javascript">
        document.write("This example represent \"double quote\" special character.");
    </script>
</body>
</html>

Run it...   »

Example Result