The core of the language.
WHAT TO DECLARE VARIABLES WITH
The modern forms: one for values that change, one for values that do not.
WHAT NOT TO USE
The older form, which behaves unexpectedly in scope.
WHAT TYPES EXIST
Numbers Text True and false The absence of a value, of two kinds Objects Arrays, which are objects Functions, which are also objects
WHY TWO KINDS OF ABSENCE
One means deliberately empty; one means never assigned.
WHAT TO BE CAREFUL WITH
Automatic type conversion in comparisons.
WHAT TO USE INSTEAD
Strict comparison, which checks type as well as value.
WHY
Loose comparison produces results that surprise everyone once.
WHAT TRUTHINESS IS
Values treated as true or false in conditions.
WHAT IS TREATED AS FALSE
Zero, empty text, and the absence of a value.
WHY THAT MATTERS
Checking for a value's presence fails when zero is legitimate.
WHAT TO DO
Check explicitly for absence, where zero is valid.