Merge pull request #2417 from lumosmind/patch-55

all operators must return a value
This commit is contained in:
Ilya Kantor 2021-01-09 15:41:26 +03:00 committed by GitHub
commit 12b23c74d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,7 @@ alert( x ); // 5
The fact of `=` being an operator, not a "magical" language construct has an interesting implication. The fact of `=` being an operator, not a "magical" language construct has an interesting implication.
Most operators in JavaScript return a value. That's obvious for `+` and `-`, but also true for `=`. All operators in JavaScript return a value. That's obvious for `+` and `-`, but also true for `=`.
The call `x = value` writes the `value` into `x` *and then returns it*. The call `x = value` writes the `value` into `x` *and then returns it*.