minor fixes
This commit is contained in:
parent
611fefd90e
commit
3ffa0beab0
5 changed files with 8 additions and 6 deletions
|
@ -212,7 +212,7 @@ But we can force the exit at any time using the special `break` directive.
|
|||
|
||||
For example, the loop below asks the user for a series of numbers, "breaking" when no number is entered:
|
||||
|
||||
```js
|
||||
```js run
|
||||
let sum = 0;
|
||||
|
||||
while (true) {
|
||||
|
|
|
@ -142,7 +142,7 @@ for (let char of str) {
|
|||
|
||||
For deeper understanding let's see how to use an iterator explicitly.
|
||||
|
||||
We'll iterate over a string in exactlly the same way as `for..of`, but with direct calls. This code creates a string iterator and gets values from it "manually":
|
||||
We'll iterate over a string in exactly the same way as `for..of`, but with direct calls. This code creates a string iterator and gets values from it "manually":
|
||||
|
||||
```js run
|
||||
let str = "Hello";
|
||||
|
@ -150,7 +150,9 @@ let str = "Hello";
|
|||
// does the same as
|
||||
// for (let char of str) alert(char);
|
||||
|
||||
*!*
|
||||
let iterator = str[Symbol.iterator]();
|
||||
*/!*
|
||||
|
||||
while (true) {
|
||||
let result = iterator.next();
|
||||
|
@ -268,7 +270,7 @@ for (let char of str) {
|
|||
alert(chars);
|
||||
```
|
||||
|
||||
...But is shorter.
|
||||
...But it is shorter.
|
||||
|
||||
We can even build surrogate-aware `slice` on it:
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ The syntax to extend another class is: `class Child extends Parent`.
|
|||
|
||||
Let's create `class Rabbit` that inherits from `Animal`:
|
||||
|
||||
```js
|
||||
```js run
|
||||
*!*
|
||||
class Rabbit extends Animal {
|
||||
*/!*
|
||||
|
|
|
@ -56,7 +56,7 @@ Now the order is as intended.
|
|||
|
||||
Remember the `unhandledrejection` event from the chapter <info:promise-error-handling>?
|
||||
|
||||
Now we can see exactly how JavaScript finds out that there was an unhandled rejection
|
||||
Now we can see exactly how JavaScript finds out that there was an unhandled rejection.
|
||||
|
||||
**"Unhandled rejection" occurs when a promise error is not handled at the end of the microtask queue.**
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ user = new Proxy(user, {
|
|||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
/* ...other flags, probable "value:..."" */
|
||||
/* ...other flags, probable "value:..." */
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue