I am trying to make a wait
function that takes a time and waits for that time, but it is not working as I expect it to.
var wait = async (t)=>{
var c = new Promise((resolve,reject)=>{setTimeout(()=>{resolve()},t)})
await c
console.log(2)
}
console.log(1)
wait(100)
console.log(3)
I know I can wait with plain setTimeout()
, but I do not want to use that.