I m a beginner in javascript and trying to learn Async Awaits functionality. I want to print functions as per awaits sequence. Please help
await setTimeout(()=>{
return "a"
}, 0)
}
async function b(callback) {
await setTimeout(()=>{
return "b"
}, 1000)
}
async function c(callback) {
await setTimeout(()=>{
return "c"
}, 500)
}
async function d(callback) {
await setTimeout(()=>{
return "d"
}, 4000)
}
//let nm = a(() => {console.log("a")})
async function printVal(){
let w = b();
w.then(res => {
console.log(res)
})
let x = await d();
x.then(res => {
console.log(res)
})
let y = await c();
y.then(res => {
console.log(res)
})
let z = await a();
z.then(res => {
console.log(res)
})
}
printVal()