Skip to content

Commit 02cf070

Browse files
committed
sync main
1 parent 2557419 commit 02cf070

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

1-js/11-async/05-promise-api/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Promise.any([
248248
]).catch(error => {
249249
console.log(error.constructor.name); // AggregateError
250250
console.log(error.errors[0]); // Error: Ouch!
251-
console.log(error.errors[1]); // Error: Error
251+
console.log(error.errors[1]); // Error: Error!
252252
});
253253
```
254254
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script>
2-
function loadScript(src) {
3-
return new Promise(function(resolve, reject) {
4-
let script = document.createElement('script');
5-
script.src = src;
6-
7-
script.onload = () => resolve(script);
8-
script.onerror = () => reject(new Error("Script load error: " + src));
9-
10-
document.head.append(script);
11-
});
12-
}
13-
</script>
2+
function loadScript(src) {
3+
return new Promise(function(resolve, reject) {
4+
let script = document.createElement('script');
5+
script.src = src;
6+
7+
script.onload = () => resolve(script);
8+
script.onerror = () => reject(new Error("Script load error: " + src));
9+
10+
document.head.append(script);
11+
});
12+
}
13+
</script>
14+

0 commit comments

Comments
 (0)