Game Development Reference
In-Depth Information
constant
number
true
false
NaN
null
undefined
'
symbol
'
symbol
Figure 12-1. The syntax diagram for constant values
Using Single and Double Quotes
When using string values and combining them with other variables, you have to be careful which
type of quotes you use (if any). If you forget the quotes, you're not writing text or characters
anymore, but a piece of a JavaScript program! There is a big difference between
"hello" and the variable name hello
The string
'123' and the value 123
The string value
The string
'+' and the operator +
Special Characters
Special characters, simply because they're special , are not always easy to indicate using a single
character between quotes. So, a number of special symbols have special notations using the
backslash symbol, as follows:
'\n' for the end-of-line symbol
'\t' for the tabulation symbol
This introduces a new problem: how to indicate the backslash character itself. The backslash
character is indicated using the double backslash . In a similar way, the backslash symbol is used to
represent the character for the single and double quotes themselves:
'\\' for the backslash symbol
'\'' or "'" for the single quote character
"\"" or '"' for the double quote character
 
 
Search WWH ::




Custom Search