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

<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.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy