Data Types
Every value in JavaScript has a type. The typeof operator tells you what type a value is.
The basic types
Try changing the values below and see how the type changes:
- String — text, written in quotes:
"hello" - Number — any number, whole or decimal:
42,3.14 - Boolean —
trueorfalse
Arrays and objects
An array holds an ordered list of values. An object holds named properties:
Note: array items are accessed by position, starting at
0 — so colors[0] is the first item, not the second.