Review
In JavaScript, array
s are simply numerically indexed collections of any value-type. string
s are somewhat “array
-like”, but they have distinct behaviors and care must be taken if you want to treat them as array
s. Numbers in JavaScript include both “integers” and floating-point values.
Several special values are defined within the primitive types.
The null
type has just one value: null
, and likewise the undefined
type has just the undefined
value. undefined
is basically the default value in any variable or property if no other value is present. The void
operator lets you create the undefined
value from any other value.
number
s include several special values, like NaN
(supposedly “Not a Number”, but really more appropriately “invalid number”); +Infinity
and -Infinity
; and -0
.
Simple scalar primitives (string
s, number
s, etc.) are assigned/passed by value-copy, but compound values (object
s, etc.) are assigned/passed by reference-copy. References are not like references/pointers in other languages — they’re never pointed at other variables/references, only at the underlying values.