JavaScript Escape Sequences

You are Here:

Escape Sequences

An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly.

The following are the list of escape sequences available in javascript

Escape SequencesExplanation
\XXXan octal Latin-1 character.
\xXXa hexa Latin-1 character
\uXXXXunicode codepoint
\'single quote
\"double quote
\\backslash
\nnew line
\ttab
\rcarriage return
\vvertical tab
\bbackspace
\fform feed

Octal Latin-1 Character

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> // check your console console.log("Latin capital letter O with circumflex -\324"); </script> </body> </html>

Hexa Latin-1 Character

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> // check your console console.log("Latin capital letter O with circumflex -\xD4"); </script> </body> </html>

Unicode Codepoint

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> // check your console console.log("Latin capital letter O with circumflex -\u00D4"); </script> </body> </html>

Single Quote

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> // check your console console.log('I\'m here'); </script> </body> </html>

Double Quote

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> console.log("I love \"JavaScript\""); </script> </body> </html>

Backslash

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> console.log('E:\\new-folder\\file.js'); </script> </body> </html>

New Line

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> console.log("Hello \n World"); </script> </body> </html>

Tab

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> console.log("Long \t Space"); </script> </body> </html>

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author