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
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/15-function-basics/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,7 +181,7 @@ In other words, to put these terms straight:
181
181
182
182
We declare functions listing their parameters, then call them passing arguments.
183
183
184
-
In the example above, one might say: "the function `sayMessage` is declared with two parameters, then called with two arguments: `from` and `"Hello"`".
184
+
In the example above, one might say: "the function `showMessage` is declared with two parameters, then called with two arguments: `from` and `"Hello"`".
Copy file name to clipboardExpand all lines: 1-js/03-code-quality/06-polyfills/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Here, in this chapter, our purpose is to get the gist of how they work, and thei
22
22
23
23
## Transpilers
24
24
25
-
A [transpiler](https://en.wikipedia.org/wiki/Source-to-source_compiler) is a special piece of software that can parse ("read and understand") modern code, and rewrite it using older syntax constructs, so that the result would be the same.
25
+
A [transpiler](https://en.wikipedia.org/wiki/Source-to-source_compiler) is a special piece of software that translates source code to another source code. It can parse ("read and understand") modern code and rewrite it using older syntax constructs, so that it'll also work in outdated engines.
26
26
27
27
E.g. JavaScript before year 2020 didn't have the "nullish coalescing operator" `??`. So, if a visitor uses an outdated browser, it may fail to understand the code like `height = height ?? 100`.
Copy file name to clipboardExpand all lines: 1-js/04-object-basics/09-object-toprimitive/article.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ In case of such operations, objects are auto-converted to primitives, and then t
9
9
10
10
That's an important limitation, as the result of `obj1 + obj2` can't be another object!
11
11
12
-
E.g. we can't make objects representing vectors or matrices (or archievements or whatever), add them and expect a "summed" object as the result. Such architectural feats are automatically "off the board".
12
+
E.g. we can't make objects representing vectors or matrices (or achievements or whatever), add them and expect a "summed" object as the result. Such architectural feats are automatically "off the board".
13
13
14
14
So, because we can't do much here, there's no maths with objects in real projects. When it happens, it's usually because of a coding mistake.
15
15
@@ -135,7 +135,7 @@ As we can see from the code, `user` becomes a self-descriptive string or a money
135
135
136
136
If there's no `Symbol.toPrimitive` then JavaScript tries to find methods `toString` and `valueOf`:
137
137
138
-
- For the "string" hint: `toString`, and if it doesn't exist, then `valueOf` (so `toString` has the priority for stirng conversions).
138
+
- For the "string" hint: `toString`, and if it doesn't exist, then `valueOf` (so `toString` has the priority for string conversions).
139
139
- For other hints: `valueOf`, and if it doesn't exist, then `toString` (so `valueOf` has the priority for maths).
140
140
141
141
Methods `toString` and `valueOf` come from ancient times. They are not symbols (symbols did not exist that long ago), but rather "regular" string-named methods. They provide an alternative "old-style" way to implement the conversion.
@@ -279,4 +279,4 @@ The conversion algorithm is:
279
279
280
280
In practice, it's often enough to implement only `obj.toString()` as a "catch-all" method for string conversions that should return a "human-readable" representation of an object, for logging or debugging purposes.
281
281
282
-
As for math operations, JavaScript doesn't provide a way to "override" them using methods, so real life projects rarely use them on objects.
282
+
As for math operations, JavaScript doesn't provide a way to "override" them using methods, so real life projects rarely use them on objects.
Copy file name to clipboardExpand all lines: 1-js/05-data-types/02-number/article.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,8 +37,8 @@ alert( 7.3e9 ); // 7.3 billions (same as 7300000000 or 7_300_000_000)
37
37
In other words, `e` multiplies the number by `1` with the given zeroes count.
38
38
39
39
```js
40
-
1e3=1*1000// e3 means *1000
41
-
1.23e6=1.23*1000000// e6 means *1000000
40
+
1e3===1*1000;// e3 means *1000
41
+
1.23e6===1.23*1000000;// e6 means *1000000
42
42
```
43
43
44
44
Now let's write something very small. Say, 1 microsecond (one millionth of a second):
@@ -59,10 +59,10 @@ In other words, a negative number after `"e"` means a division by 1 with the giv
59
59
60
60
```js
61
61
// -3 divides by 1 with 3 zeroes
62
-
1e-3=1/1000 (=0.001)
62
+
1e-3===1/1000; //0.001
63
63
64
64
// -6 divides by 1 with 6 zeroes
65
-
1.23e-6=1.23/1000000 (=0.00000123)
65
+
1.23e-6===1.23/1000000; //0.00000123
66
66
```
67
67
68
68
### Hex, binary and octal numbers
@@ -118,6 +118,7 @@ Please note that two dots in `123456..toString(36)` is not a typo. If we want to
118
118
If we placed a single dot: `123456.toString(36)`, then there would be an error, because JavaScript syntax implies the decimal part after the first dot. And if we place one more dot, then JavaScript knows that the decimal part is empty and now goes the method.
It may look difficult at first sight, but becomes easy to understand after you use it once or twice. We can make powerful chains of transforms this way.
103
+
It may look difficult at first sight, but becomes easy to understand after you use it once or twice. We can make powerful chains of transforms this way.
```smart header="The only attribute change possible: writable true -> false"
271
+
There's a minor exception about changing flags.
272
+
273
+
We can change `writable: true` to `false` for a non-configurable property, thus preventing its value modification (to add another layer of protection). Not the other way around though.
0 commit comments