This commit is contained in:
Ilya Kantor 2017-05-10 18:07:56 +03:00
parent f16b0cf21d
commit d7bdee140f
4 changed files with 7 additions and 5 deletions

View file

@ -11,7 +11,7 @@ What are results of these expressions?
"" - 1 + 0 "" - 1 + 0
true + false true + false
6 / "3" 6 / "3"
2" * "3" "2" * "3"
4 + 5 + "px" 4 + 5 + "px"
"$" + 4 + 5 "$" + 4 + 5
"4" - 2 "4" - 2

View file

@ -234,7 +234,9 @@ alert( 4 ** (1/2) ); // 2 (power of 1/2 is the same as a square root, that's mat
alert( 8 ** (1/3) ); // 2 (power of 1/3 is the same as a cubic root) alert( 8 ** (1/3) ); // 2 (power of 1/3 is the same as a cubic root)
``` ```
## Increment/decrement: ++, -- ## Increment/decrement
<!-- Can't use -- in title, because built-in parse turns it into -->
Increasing or decreasing a number by one is among the most common numerical operations. Increasing or decreasing a number by one is among the most common numerical operations.

View file

@ -180,7 +180,7 @@ The reason is that an equality check `==` and comparisons `> < >= <=` work diffe
From the other hand, the equality check `==` for `undefined` and `null` works by the rule, without any conversions. They equal each other and don't equal anything else. That's why (2) `null == 0` is false. From the other hand, the equality check `==` for `undefined` and `null` works by the rule, without any conversions. They equal each other and don't equal anything else. That's why (2) `null == 0` is false.
### An uncomparable undefined ### An incomparable undefined
The value `undefined` shouldn't participate in comparisons at all: The value `undefined` shouldn't participate in comparisons at all:

View file

@ -1,7 +1,7 @@
# Objects # Objects
As we know, there are 7 language types in JavaScript. Six of them are called "primitive", because their values contain only a single thing (be it a string or a number or whatever). As we know from the chapter <info:types>, there are 7 language types in JavaScript. Six of them are called "primitive", because their values contain only a single thing (be it a string or a number or whatever).
In contrast, objects are used to store keyed collections of various data and more complex entities. In JavaScript, objects penetrate almost every aspect of the language. So we must understand them first before going in-depth anywhere else. In contrast, objects are used to store keyed collections of various data and more complex entities. In JavaScript, objects penetrate almost every aspect of the language. So we must understand them first before going in-depth anywhere else.
@ -573,7 +573,7 @@ user = {
}; };
``` ```
...But what if we want to make constant object properties? So that `user.age = 25` would give an error. That's possible too. We'll cover it in the chapter <info:property-flags-descriptors>. ...But what if we want to make constant object properties? So that `user.age = 25` would give an error. That's possible too. We'll cover it in the chapter <info:property-descriptors>.
## Cloning and merging, Object.assign ## Cloning and merging, Object.assign