Last updated 2 years ago
Was this helpful?
⟩ ⟩ ⟩ =
=
(operator) assigns value to variable / property / element, and returns the assigned value.
var
is ignored and won't trigger any error, even in strict mode
⭐️ the assignment (=) part is applied
👉 var redeclaration applied even in strict mode❗️
⭐️ assignment (=) to an undeclared identifier will result in
accidental global variable in sloppy mode❗️ in sloppy mode.
⛔️ ReferenceError ⟩ 'xxx' is not defined❗️ in strict mode
the assignment of a always creates/sets a property in the original object, it never modifies objects in the .
destructuring assignment
dot notation (.) / bracket notation [] - assignment of a property
strict equality (===)
sloppy equality (==)
lvalue is a term for variable / property / element.
JavaScript: The Definitive Guide ⟩ 4.11 Assignment Expressions
⟩ ⟩