Converting from one value type to another, such as from string to number, is referred to in JS as "coercion."
- const: can be re-assigned but not mutated.
it appears as a statement by itself, not as an expression in another statement. The association between the identifier and the function value happens during the compile phase of the code, before that code is executed..
This function is an expression that is assigned to the variable. Different from the function declaration form, a function expression is not associated with its identifier until that statement during runtime..
Let vs var:
let allows a more limited access to the variable than var. This is called "block scoping" as opposed to regular or function scoping.
in JS programs, values can either appear as literal values (as many of the preceding examples illustrate), or they can be held in variables; think of variables as just containers for values.
most fundamental unit of value. Values are data. They're how the program maintains state. Values come in two forms in JS: primitive and object. Primitives are held by value. Objects are held by reference..
var vs let:
The let keyword has some differences to var, with the most obvious being that let allows a more limited access to the variable than var. This is called "block scoping" as opposed to regular or function scoping. (...) But var is still useful in that it communicates "this variable will be seen by a wider scope (of the whole function)". Both declaration forms can be appropriate in any given part of a program, depending on the circumstances.
Top comments (0)