Files
JavaScript-from-Beginner-to…/Chapter 13/Exercise_13.3.js
T
2021-11-30 18:44:31 +05:30

18 lines
389 B
JavaScript
Vendored

let cnt = 0;
function outputTime(val) {
return new Promise(resolve => {
setTimeout(() => {
cnt++;
resolve(`x value ${val} counter:${cnt}`);
}, 1000);
});
}
async function aCall(val) {
console.log(`ready ${val} counter:${cnt}`);
const res = await outputTime(val);
console.log(res);
}
for (let x = 1; x < 4; x++) {
aCall(x);
}