• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Literals

JavaScript supplies a number of literals for use within the language, known as special characters. JavaScript also supplies syntax for defining literals of various object types. The literals, and what they translate into, are shown in Table 13.1.

Table 13.1. Literals in JavaScript
Literal Notation Result
\' '
\"
\\ \
\n New line character
\t Tab character
\r Carriage return (Enter key)
\v Vertical tab
\b Backspace
\f Form feed
\x## ASCII hexadecimal code of character
\u#### Unicode hexadecimal code of character
\### ASCII octal code of character
{propname:propval} New Object() (literal, see Chapter 1)
["element0", "element1"] New Array() (literal, see Chapter 3)
[-]####[.]####[e[-]##] New Number() (literal, see Chapter 7)
0### Octal number (literal, see Chapter 7)
0x### Hexadecimal number (literal, see Chapter 7)
/expression/flags (literal, see Chapter 9) New RegExp("expression", "flags")
"string"
'string'

New String(string) (literal, see Chapter 4)



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint