Skip to content

Commit fd9161a

Browse files
committed
merging all conflicts
2 parents b85092b + f830bc5 commit fd9161a

File tree

54 files changed

+172
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+172
-139
lines changed

1-js/01-getting-started/1-intro/article.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@ Moderne Werkzeuge machen die Transpilation sehr schnell und transparent und erla
107107

108108
Beispiele für solche Sprachen sind:
109109

110+
<<<<<<< HEAD
110111
- [CoffeeScript](http://coffeescript.org/) ist ein "syntactic sugar" für JavaScript. Es führt eine kürzere Syntax ein, was uns erlaubt, klareren und präziseren Code zu schreiben. Usually, Ruby devs like it.
111112
- [TypeScript](http://www.typescriptlang.org/) ist darauf konzentriert "strict data typing" hinzuzufügen. TypeScript verfolg das Ziel den Entwicklungsprozess und den Support für komplexe Systeme zu vereinfachen. Die Sprache wurde von Microsoft entwickelt.
112113
- [Flow](http://flow.org/) fügt auch "data typing" hinzu, aber auf eine andere Art und Weise. Sie wurde von Facebook entwickelt.
113114
- [Dart](https://www.dartlang.org/) ist eine eigenständige Sprache, die eine eigene Engine hat, die in Nicht-Browser-Umgebungen (wie z.B. mobilen Anwendungen) läuft, aber auch in JavaScript umgesetzt werden kann. Sie wurde von Google entwickelt.
115+
=======
116+
- [CoffeeScript](http://coffeescript.org/) is a "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
117+
- [TypeScript](http://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
118+
- [Flow](http://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
119+
- [Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
120+
- [Brython](https://brython.info/) is a Python transpiler to JavaScript that allow to write application in pure Python without JavaScript.
121+
>>>>>>> f830bc5d9454d85829e011d914f215eb5896579a
114122
115123
Es gibt noch mehr. Auch wenn wir eine der transpilierten Sprachen verwenden sollten wir auch JavaScript trozdem kennen. Es ist wichtig zu verstehen, was im Hintergrund passiert und was wir eigentlich tun.
116124

1-js/02-first-steps/05-types/article.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ Mehr über das Arbeiten mit Zahlen erfahren wir in diesem Kapitel <info:number>.
6666

6767
## BigInt
6868

69+
<<<<<<< HEAD
6970
In JavaScript kann der Typ "Zahl" keine ganzzahligen Werte darstellen, die größer als <code>(2<sup>53</sup>-1)</code> (das ist `9007199254740991`) oder kleiner als <code>-(-2<sup>53</sup>-1)</code> für Negative sind. Es handelt sich um eine technische Einschränkung, die durch ihre interne Darstellung bedingt ist.
71+
=======
72+
In JavaScript, the "number" type cannot represent integer values larger than <code>(2<sup>53</sup>-1)</code> (that's `9007199254740991`), or less than <code>-(2<sup>53</sup>-1)</code> for negatives. It's a technical limitation caused by their internal representation.
73+
>>>>>>> f830bc5d9454d85829e011d914f215eb5896579a
7074

7175
Für die meisten Zwecke reicht das völlig aus, aber manchmal brauchen wir wirklich große Zahlen, z.B. für die Kryptographie oder Zeitstempel mit Mikrosekunden-Genauigkeit.
7276

@@ -81,8 +85,13 @@ const bigInt = 1234567890123456789012345678901234567890n;
8185

8286
Da `BigInt`-Zahlen selten benötigt werden, behandeln wir sie hier nicht, sondern widmen ihnen ein eigenes Kapitel <info:bigint>. Lies es, wenn du so große Zahlen brauchst.
8387

88+
<<<<<<< HEAD
8489
```smart header="Compatability issues"
8590
Im Moment wird `BigInt` in Firefox/Chrome/Edge unterstützt, aber nicht in Safari/IE.
91+
=======
92+
```smart header="Compatibility issues"
93+
Right now `BigInt` is supported in Firefox/Chrome/Edge, but not in Safari/IE.
94+
>>>>>>> f830bc5d9454d85829e011d914f215eb5896579a
8695
```
8796
8897
## String

1-js/02-first-steps/06-alert-prompt-confirm/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ Da wir den Browser als unsere Demo-Umgebung verwenden, wollen wir einige Funktio
44

55
## alert
66

7+
<<<<<<< HEAD
78
Diese haben wir bereits gesehen. Es zeigt eine Meldung an und wartet darauf, dass der Benutzer "OK" drückt.
9+
=======
10+
This one we've seen already. It shows a message and waits for the user to press "OK".
11+
>>>>>>> f830bc5d9454d85829e011d914f215eb5896579a
812
913
Zum Beispiel:
1014

1-js/02-first-steps/10-ifelse/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Conditional operators: if, '?'
1+
# Conditional branching: if, '?'
22

33
Sometimes, we need to perform different actions based on different conditions.
44

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,13 @@ Die Präzedenz der Operators UND `&&` ist höher als die von ODER `||`.
223223
Der Code `a && b || c && d` verhält sich daher i.w. so, als ob die Ausdrücke mit `&&` in Klammern gesetzt würden: `(a && b) || (c && d)`.
224224
````
225225

226+
<<<<<<< HEAD
226227
````warn header="Ersetze `if` nicht durch || oder &&"
227228
Manchmal wird der Operator UND `&&` als "Kürzel zum Schreiben von `if`" verwendet.
229+
=======
230+
````warn header="Don't replace `if` with || or &&"
231+
Sometimes, people use the AND `&&` operator as a "shorter way to write `if`".
232+
>>>>>>> f830bc5d9454d85829e011d914f215eb5896579a
228233

229234
Beispiel:
230235

1-js/02-first-steps/12-nullish-coalescing-operator/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Which behavior is better depends on a particular use case. When zero height is a
6868
6969
## Precedence
7070
71-
The precedence of the `??` operator is rather low: `7` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table).
71+
The precedence of the `??` operator is rather low: `5` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table).
7272
7373
So `??` is evaluated after most other operations, but before `=` and `?`.
7474

1-js/03-code-quality/02-coding-style/1-style-errors/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function pow(x,n) // <- no space between arguments
1212

1313
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
1414
// but better make it 2 lines, also there's no spaces and missing ;
15-
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
15+
if (n<=0) // <- no spaces inside (n <= 0), and should be extra line above it
1616
{ // <- figure bracket on a separate line
1717
// below - long lines can be split into multiple lines for improved readability
1818
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
@@ -39,7 +39,7 @@ function pow(x, n) {
3939
let x = prompt("x?", "");
4040
let n = prompt("n?", "");
4141

42-
if (n < 0) {
42+
if (n <= 0) {
4343
alert(`Power ${n} is not supported,
4444
please enter an integer number greater than zero`);
4545
} else {

1-js/04-object-basics/03-garbage-collection/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Simply put, "reachable" values are those that are accessible or usable somehow.
2323

2424
2. Any other value is considered reachable if it's reachable from a root by a reference or by a chain of references.
2525

26-
For instance, if there's an object in a local variable, and that object has a property referencing another object, that object is considered reachable. And those that it references are also reachable. Detailed examples to follow.
26+
For instance, if there's an object in a global variable, and that object has a property referencing another object, that object is considered reachable. And those that it references are also reachable. Detailed examples to follow.
2727

2828
There's a background process in the JavaScript engine that is called [garbage collector](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)). It monitors all objects and removes those that have become unreachable.
2929

1-js/04-object-basics/08-symbol/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ user.id = "Their id value"
121121
// Boom! overwritten by another script!
122122
```
123123

124-
### Symbols in a literal
124+
### Symbols in an object literal
125125

126126
If we want to use a symbol in an object literal `{...}`, we need square brackets around it.
127127

@@ -133,7 +133,7 @@ let id = Symbol("id");
133133
let user = {
134134
name: "John",
135135
*!*
136-
[id]: 123 // not "id: 123"
136+
[id]: 123 // not "id": 123
137137
*/!*
138138
};
139139
```

1-js/04-object-basics/09-object-toprimitive/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ There are three variants of type conversion, so-called "hints", described in the
4646
`"default"`
4747
: Occurs in rare cases when the operator is "not sure" what type to expect.
4848

49-
For instance, binary plus `+` can work both with strings (concatenates them) and numbers (adds them), so both strings and numbers would do. So if the a binary plus gets an object as an argument, it uses the `"default"` hint to convert it.
49+
For instance, binary plus `+` can work both with strings (concatenates them) and numbers (adds them), so both strings and numbers would do. So if a binary plus gets an object as an argument, it uses the `"default"` hint to convert it.
5050

5151
Also, if an object is compared using `==` with a string, number or a symbol, it's also unclear which conversion should be done, so the `"default"` hint is used.
5252

1-js/05-data-types/04-array/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ An array is a special kind of object. The square brackets used to access a prope
193193

194194
They extend objects providing special methods to work with ordered collections of data and also the `length` property. But at the core it's still an object.
195195

196-
Remember, there are only 7 basic types in JavaScript. Array is an object and thus behaves like an object.
196+
Remember, there are only eight basic data types in JavaScript (see the [Data types](https://javascript.info/types) chapter for more info). Array is an object and thus behaves like an object.
197197

198198
For instance, it is copied by reference:
199199

1-js/05-data-types/05-array-methods/6-calculator-extendable/_js.view/solution.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ function Calculator() {
1010
let split = str.split(' '),
1111
a = +split[0],
1212
op = split[1],
13-
b = +split[2]
13+
b = +split[2];
1414

1515
if (!this.methods[op] || isNaN(a) || isNaN(b)) {
1616
return NaN;
1717
}
1818

1919
return this.methods[op](a, b);
20-
}
20+
};
2121

2222
this.addMethod = function(name, func) {
2323
this.methods[name] = func;

1-js/05-data-types/11-date/1-new-date/solution.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@ The `new Date` constructor uses the local time zone. So the only important thing
22

33
So February has number 1.
44

5+
Here's an example with numbers as date components:
6+
7+
```js run
8+
//new Date(year, month, date, hour, minute, second, millisecond)
9+
let d1 = new Date(2012, 1, 20, 3, 12);
10+
alert( d1 );
11+
```
12+
We could also create a date from a string, like this:
13+
514
```js run
6-
let d = new Date(2012, 1, 20, 3, 12);
7-
alert( d );
15+
//new Date(datastring)
16+
let d2 = new Date("February 20, 2012 03:12:00");
17+
alert( d2 );
818
```

1-js/06-advanced-functions/03-closure/7-let-scope/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function func() {
1515
func();
1616
```
1717

18-
In this example we can observe the peculiar difference between a "non-existing" and "unitialized" variable.
18+
In this example we can observe the peculiar difference between a "non-existing" and "uninitialized" variable.
1919

2020
As you may have read in the article [](info:closure), a variable starts in the "uninitialized" state from the moment when the execution enters a code block (or a function). And it stays uninitalized until the corresponding `let` statement.
2121

1-js/06-advanced-functions/03-closure/article.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11

2-
# Variable scope
2+
# Variable scope, closure
33

4-
JavaScript is a very function-oriented language. It gives us a lot of freedom. A function can be created dynamically, passed as an argument to another function and called from a totally different place of code later.
4+
JavaScript is a very function-oriented language. It gives us a lot of freedom. A function can be created at any moment, passed as an argument to another function, and then called from a totally different place of code later.
55

6-
We already know that a function can access variables outside of it.
6+
We already know that a function can access variables outside of it ("outer" variables).
77

8-
Now let's expand our knowledge to include more complex scenarios.
8+
But what happens if outer variables change since a function is created? Will the function get newer values or the old ones?
9+
10+
And what if a function is passed along as a parameter and called from another place of code, will it get access to outer variables at the new place?
11+
12+
Let's expand our knowledge to understand these scenarios and more complex ones.
913

1014
```smart header="We'll talk about `let/const` variables here"
1115
In JavaScript, there are 3 ways to declare a variable: `let`, `const` (the modern ones), and `var` (the remnant of the past).

1-js/06-advanced-functions/05-global-object/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The global object provides variables and functions that are available anywhere.
55

66
In a browser it is named `window`, for Node.js it is `global`, for other environments it may have another name.
77

8-
Recently, `globalThis` was added to the language, as a standardized name for a global object, that should be supported across all environments. In some browsers, namely non-Chromium Edge, `globalThis` is not yet supported, but can be easily polyfilled.
8+
Recently, `globalThis` was added to the language, as a standardized name for a global object, that should be supported across all environments. It's supported in all major browsers.
99

1010
We'll use `window` here, assuming that our environment is a browser. If your script may run in other environments, it's better to use `globalThis` instead.
1111

@@ -81,7 +81,7 @@ if (!window.Promise) {
8181
That includes JavaScript built-ins, such as `Array` and environment-specific values, such as `window.innerHeight` -- the window height in the browser.
8282
- The global object has a universal name `globalThis`.
8383

84-
...But more often is referred by "old-school" environment-specific names, such as `window` (browser) and `global` (Node.js). As `globalThis` is a recent proposal, it's not supported in non-Chromium Edge (but can be polyfilled).
84+
...But more often is referred by "old-school" environment-specific names, such as `window` (browser) and `global` (Node.js).
8585
- We should store values in the global object only if they're truly global for our project. And keep their number at minimum.
8686
- In-browser, unless we're using [modules](info:modules), global functions and variables declared with `var` become a property of the global object.
8787
- To make our code future-proof and easier to understand, we should access properties of the global object directly, as `window.x`.

1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ importance: 5
66

77
The result of `debounce(f, ms)` decorator is a wrapper that suspends calls to `f` until there's `ms` milliseconds of inactivity (no calls, "cooldown period"), then invokes `f` once with the latest arguments.
88

9+
In other words, `debounce` is like a secretary that accepts "phone calls", and waits until there's `ms` milliseconds of being quiet. And only then it transfers the latest call information to "the boss" (calls the actual `f`).
10+
911
For instance, we had a function `f` and replaced it with `f = debounce(f, 1000)`.
1012

1113
Then if the wrapped function is called at 0ms, 200ms and 500ms, and then there are no calls, then the actual `f` will be only called once, at 1500ms. That is: after the cooldown period of 1000ms from the last call.
@@ -25,7 +27,6 @@ setTimeout( () => f("c"), 500);
2527
// debounced function waits 1000ms after the last call and then runs: alert("c")
2628
```
2729

28-
2930
Now a practical example. Let's say, the user types something, and we'd like to send a request to the server when the input is finished.
3031

3132
There's no point in sending the request for every character typed. Instead we'd like to wait, and then process the whole result.
@@ -43,9 +44,8 @@ See? The second input calls the debounced function, so its content is processed
4344

4445
So, `debounce` is a great way to process a sequence of events: be it a sequence of key presses, mouse movements or something else.
4546

46-
4747
It waits the given time after the last call, and then runs its function, that can process the result.
4848

4949
The task is to implement `debounce` decorator.
5050

51-
Hint: that's just a few lines if you think about it :)
51+
Hint: that's just a few lines if you think about it :)

1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ importance: 5
66

77
Create a "throttling" decorator `throttle(f, ms)` -- that returns a wrapper.
88

9-
When it's called multiple times, it passes the call to `f` at maximum once per `ms` milliseconds.
9+
When it's called multiple times, it passes the call to `f` at maximum once per `ms` milliseconds.
1010

1111
The difference with debounce is that it's completely different decorator:
1212
- `debounce` runs the function once after the "cooldown" period. Good for processing the final result.
1313
- `throttle` runs it not more often than given `ms` time. Good for regular updates that shouldn't be very often.
1414

15+
In other words, `throttle` is like a secretary that accepts phone calls, but bothers the boss (calls the actual `f`) not more often than once per `ms` milliseconds.
16+
1517
Let's check the real-life application to better understand that requirement and to see where it comes from.
1618

1719
**For instance, we want to track mouse movements.**

1-js/06-advanced-functions/10-bind/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sayHi(); // Hello, John!
167167
setTimeout(sayHi, 1000); // Hello, John!
168168

169169
// even if the value of user changes within 1 second
170-
// sayHi uses the pre-bound value
170+
// sayHi uses the pre-bound value which is reference to the old user object
171171
user = {
172172
sayHi() { alert("Another user in setTimeout!"); }
173173
};
@@ -202,7 +202,7 @@ for (let key in user) {
202202
}
203203
```
204204

205-
JavaScript libraries also provide functions for convenient mass binding , e.g. [_.bindAll(obj)](http://lodash.com/docs#bindAll) in lodash.
205+
JavaScript libraries also provide functions for convenient mass binding , e.g. [_.bindAll(object, methodNames)](http://lodash.com/docs#bindAll) in lodash.
206206
````
207207
208208
## Partial functions

1-js/08-prototypes/01-prototype-inheritance/article.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ alert(admin.fullName); // John Smith (*)
197197

198198
// setter triggers!
199199
admin.fullName = "Alice Cooper"; // (**)
200+
201+
alert(admin.fullName); // Alice Cooper , state of admin modified
202+
alert(user.fullName); // John Smith , state of user protected
200203
```
201204

202205
Here in the line `(*)` the property `admin.fullName` has a getter in the prototype `user`, so it is called. And in the line `(**)` the property has a setter in the prototype, so it is called.

1-js/08-prototypes/04-prototype-methods/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The `__proto__` is considered outdated and somewhat deprecated (in browser-only
77

88
The modern methods are:
99

10-
- [Object.create(proto[, descriptors])](mdn:js/Object/create) -- creates an empty object with given `proto` as `[[Prototype]]` and optional property descriptors.
10+
- [Object.create(proto, [descriptors])](mdn:js/Object/create) -- creates an empty object with given `proto` as `[[Prototype]]` and optional property descriptors.
1111
- [Object.getPrototypeOf(obj)](mdn:js/Object/getPrototypeOf) -- returns the `[[Prototype]]` of `obj`.
1212
- [Object.setPrototypeOf(obj, proto)](mdn:js/Object/setPrototypeOf) -- sets the `[[Prototype]]` of `obj` to `proto`.
1313

@@ -175,7 +175,7 @@ alert(Object.keys(chineseDictionary)); // hello,bye
175175

176176
Modern methods to set up and directly access the prototype are:
177177

178-
- [Object.create(proto[, descriptors])](mdn:js/Object/create) -- creates an empty object with a given `proto` as `[[Prototype]]` (can be `null`) and optional property descriptors.
178+
- [Object.create(proto, [descriptors])](mdn:js/Object/create) -- creates an empty object with a given `proto` as `[[Prototype]]` (can be `null`) and optional property descriptors.
179179
- [Object.getPrototypeOf(obj)](mdn:js/Object.getPrototypeOf) -- returns the `[[Prototype]]` of `obj` (same as `__proto__` getter).
180180
- [Object.setPrototypeOf(obj, proto)](mdn:js/Object.setPrototypeOf) -- sets the `[[Prototype]]` of `obj` to `proto` (same as `__proto__` setter).
181181

1-js/09-classes/06-instanceof/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ For most environment-specific objects, there is such a property. Here are some b
190190
191191
```js run
192192
// toStringTag for the environment-specific object and class:
193-
alert( window[Symbol.toStringTag]); // window
193+
alert( window[Symbol.toStringTag]); // Window
194194
alert( XMLHttpRequest.prototype[Symbol.toStringTag] ); // XMLHttpRequest
195195
196196
alert( {}.toString.call(window) ); // [object Window]

1-js/09-classes/07-mixins/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ let eventMixin = {
154154
* this.trigger('select', data1, data2);
155155
*/
156156
trigger(eventName, ...args) {
157-
if (!this._eventHandlers || !this._eventHandlers[eventName]) {
157+
if (!this._eventHandlers?.[eventName]) {
158158
return; // no handlers for that event name
159159
}
160160

1-js/10-error-handling/1-try-catch/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ The "rethrowing" technique can be explained in more detail as:
363363
364364
1. Catch gets all errors.
365365
2. In the `catch(err) {...}` block we analyze the error object `err`.
366-
2. If we don't know how to handle it, we do `throw err`.
366+
3. If we don't know how to handle it, we do `throw err`.
367367
368368
Usually, we can check the error type using the `instanceof` operator:
369369

1-js/11-async/04-promise-error-handling/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Here the `.catch` block finishes normally. So the next successful `.then` handle
122122
In the example below we see the other situation with `.catch`. The handler `(*)` catches the error and just can't handle it (e.g. it only knows how to handle `URIError`), so it throws it again:
123123

124124
```js run
125-
// the execution: catch -> catch -> then
125+
// the execution: catch -> catch
126126
new Promise((resolve, reject) => {
127127

128128
throw new Error("Whoops!");

0 commit comments

Comments
 (0)