Skip to content

Commit 43e387d

Browse files
committed
Minor fixes
1 parent aec3b17 commit 43e387d

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

JavaScript/4-unhandled.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ sum(7, 'A')
1313
console.log({ data });
1414
});
1515

16+
setTimeout(() => {
17+
console.log('after all');
18+
}, 1000);
19+
1620
// UnhandledPromiseRejectionWarning: Error: a and b should be numbers

JavaScript/7-handled.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const p1 = sum(7, 'A')
2121
console.log(data);
2222
});
2323

24-
//p1.catch(err => {
25-
// console.log({ catch1: err });
26-
//});
24+
p1.catch(err => {
25+
console.log({ catch1: err });
26+
});
2727

2828
setTimeout(() => {
2929
p1.catch(err => {

JavaScript/8-multiple.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const sum = (a, b) => new Promise((resolve, reject) => {
44
if (typeof a === 'number' && typeof b === 'number') {
55
resolve(a + b);
6-
resolve(a + b);
76
} else {
87
reject(new Error('a and b should be numbers'));
98
}

0 commit comments

Comments
 (0)