May 2011
Intermediate to advanced
1096 pages
40h 54m
English
A literal is a data value that appears directly in a program. The following are all literals:
12// The number twelve1.2// The number one point two"hello world"// A string of text'Hi'// Another stringtrue// A Boolean valuefalse// The other Boolean value/javascript/gi// A "regular expression" literal (for pattern matching)null// Absence of an object
Complete details on numeric and string literals appear in Chapter 3. Regular expression literals are covered in Chapter 10. More complex expressions (see Object and Array Initializers) can serve as array and object literals. For example:
{x:1,y:2}// An object initializer[1,2,3,4,5]// An array initializer
Read now
Unlock full access