www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons JavaScript Working with Special Characters Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
Lesson 24
Lesson 25
Lesson 26
Lesson 27
Lesson 28
Lesson 29
Lesson 30
Lesson 31
Lesson 32
Lesson 33
Lesson 34
Lesson 35
Lesson 36
Lesson 37
Lesson 38
Lesson 39
Lesson 40
Lesson 41
Lesson 42
Lesson 43
Lesson 44
Lesson 45
Lesson 46
Lesson 47
Lesson 48
Lesson 49
We know that we need to enclose a string in double or single quotes in JavaScript programming language. But what if we need to have double or single quotes as part of our string. What about adding a new line symbol within a long string, long enough to span more than a single paragraph?

JavaScript provides us a technique called escape sequence to add special characters to our strings. We use the backslash (\) symbol followed by the special character that we need to make part of our strings.

The following is an example of escaping sequence:

mytxt = "This string has \"ESCAPE SEQUENCE\" characters";

The following table lists more commonly used escape sequence characters:
Escape Sequence Character
\' Single quotation mark
\" Double quotation mark
\\ Backslash
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Horizontal tab
\ddd Octal sequence (3 digits: ddd)
\xdd Hexadecimal sequence (2 digits: dd)
\udddd Unicode sequence (4 hex digits: dddd)

Next >>> Lesson No. 44: JavaScript Cookies





Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.