Skip to content

Commit 6bad396

Browse files
authored
Q34 solution improvement
1 parent 271ad9c commit 6bad396

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

challenges/async.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,14 +1221,14 @@ PromiseAll([
12211221
```js
12221222
// asynchronous helper function returning a promise which gets resolved after the specified delay with data
12231223
function asyncFunc(data, delay){
1224-
return new Promise(resolve => setTimeout(()=> resolve(data), delay));
1224+
return new Promise(resolve => setTimeout(resolve, delay, data));
12251225
}
12261226
12271227
function* gen() {
12281228
// async function
12291229
const num1 = yield new asyncFunc(2, 1000);
12301230
const num2 = yield new asyncFunc(1, 2000);
1231-
console.log(num1 + num2);
1231+
console.log(num1 + num2); // 3 (2 + 1)
12321232
}
12331233
12341234
function executeGeneratorWithPromise(gen) {

0 commit comments

Comments
 (0)