You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[`min` is greater than `max`](#min-is-greater-than-max)
117
116
-[`arguments` binding](#arguments-binding)
118
117
-[An `alert` from hell](#an-alert-from-hell)
119
118
-[An infinite timeout](#an-infinite-timeout)
@@ -1723,17 +1722,32 @@ See for reference `NOTE 2` on the ECMA-262 definition for `toFixed`.
1723
1722
1724
1723
## `Math.max()` less than `Math.min()`
1725
1724
1725
+
I find this example hilarious:
1726
+
1726
1727
```js
1727
-
Math.min(1, 4, 7, 2); // -> 1
1728
-
Math.max(1, 4, 7, 2); // -> 7
1729
-
Math.min(); // -> Infinity
1730
-
Math.max(); // -> -Infinity
1731
1728
Math.min() >Math.max(); // -> true
1729
+
Math.min() <Math.max(); // -> false
1732
1730
```
1733
1731
1734
1732
### 💡 Explanation:
1735
1733
1736
-
-[Why is Math.max() less than Math.min()?](https://charlieharvey.org.uk/page/why_math_max_is_less_than_math_min) by Charlie Harvey
1734
+
This is a simple one. Let's consider each part of this expression separately:
1735
+
1736
+
```js
1737
+
Math.min(); // -> Infinity
1738
+
Math.max(); // -> -Infinity
1739
+
Infinity>-Infinity; // -> true
1740
+
```
1741
+
1742
+
Why so? Well, `Math.max()` is not the same thing as `Number.MAX_VALUE`. It does not return the largest possible number.
1743
+
1744
+
`Math.max` takes arguments, tries to convert the to numbers, compares each one and then returns the largest remaining. If no arguments are given, the result is −∞. If any value is `NaN`, the result is `NaN`.
1745
+
1746
+
The opposite is happening for `Math.min`. `Math.min` returns ∞, if no arguments are given.
-[Why is `Math.max()` less than `Math.min()`?](https://charlieharvey.org.uk/page/why_math_max_is_less_than_math_min) by Charlie Harvey
1737
1751
1738
1752
## Comparing `null` to `0`
1739
1753
@@ -1906,35 +1920,6 @@ if (true) {
1906
1920
1907
1921
Surprisingly, it behaviors the same! You can guess here that `{foo: 'bar'}{}` is a block.
1908
1922
1909
-
## `min` is greater than `max`
1910
-
1911
-
I find this example hilarious:
1912
-
1913
-
```js
1914
-
Math.min() >Math.max(); // -> true
1915
-
Math.min() <Math.max(); // -> false
1916
-
```
1917
-
1918
-
### 💡 Explanation:
1919
-
1920
-
This is a simple one. Let's consider each part of this expression separately:
1921
-
1922
-
```js
1923
-
Math.min(); // -> Infinity
1924
-
Math.max(); // -> -Infinity
1925
-
Infinity>-Infinity; // -> true
1926
-
```
1927
-
1928
-
Why so? Well, `Math.max()` is not the same thing as `Number.MAX_VALUE`. It does not return the largest possible number.
1929
-
1930
-
`Math.max` takes arguments, tries to convert the to numbers, compares each one and then returns the largest remaining. If no arguments are given, the result is −∞. If any value is `NaN`, the result is `NaN`.
1931
-
1932
-
The opposite is happening for `Math.min`. `Math.min` returns ∞, if no arguments are given.
0 commit comments