Types, Values, and Variables Back
- JavaScript's types can be divided into primitive types and object types.
- JavaScript's types can also be categorized as mutable and immutable types.
- mutable types: value can change
- Objects
- Arrays
- ...
- immutable types: value can not change
- Numbers
- booleans
- null
- undefined
- strings
- symbol (new in ES6)
- ...
- mutable types: value can change
var x;
x = 0;
x //=>0
//JavaScript supports several types of values
x = 1; //integers
x = 0.1; //real
x = "Aloha"; //String in quatation marks
x = 'Aloha'; //String in single quatations
x = true; //boolean
x = null; //no value
x = undefined; //like null