February 4, 2016
Escape Sequence Character in JavaScript
In JavaScript, we have some characters which have some special meaning. For example, a string is always surrounded by double quotation marks or single quotation marks. First quotation mark determines the start of a string and second quotation mark determines the end of a string.
But in case, you want to write a string on the document which contains either double quotation mark or single quotation mark then that is not possible. In such cases, we make use of escape sequence character which is backslash(\). An example of such scenario is given below. To get complete list of escape sequences, please Click Here.
<!DOCTYPE html> <html> <head> <title>JavaScript Tutorial </title> </head> <body> <script type="text/javascript"> document.write("Hi , This is a \"JavaScript Tutorial\" for Beginners.") </script> </body> </html>