Variables
Declare variables with let
and constants with const
.
Avoid variable declarations with
var
unless maintaining legacy code
Constants with mutable values
With const
, a name is permanently bound to a value in scope and can't be reassigned.
However, if the value is an object, then the value is still mutable.
Contents