This is the code I'm wondering about.Why can I await all that function without return promise?
async function main() {
await taskOne();
await taskTwo();
await taskThree();
await taskFour();
}
main();
function taskOne() {
setTimeout(function () {
console.log("task 1");
}, 500);
}
function taskTwo() {
console.log("task 2");
}
function taskThree() {
setTimeout(function() {
console.log("task 3");
}, 1000)
}
function taskFour() {
console.log("task 4");
}
Can someone explain? Why isn't necessary to return promise?