Java Reference
In-Depth Information
Data Types
JavaScript has six different types of value. There are five primitive data types :
• string
• number
• Boolean
• undefined
• null
Any value that isn't one of the primitive data types listed is an object (these are covered in
Chapter 5 ) . We'll discuss each primitive value over the next few pages.
JavaScript has a special operator called typeof for finding out the type of a value.
Here are some examples of the different value types:
typeof "hello"
<< "string"
typeof 10
<< "number"
typeof true
<< "boolean"
typeof { ninja: "turtle" }
<< "object"
Note: Operators
An operator applies an operation to a value, which is known as the operand .
A unary operator only requires one operand; for example:
Search WWH ::

Custom Search