+ 2

how do i console log "work1" in 3s , then "work2" in 3.5s ,then "work3" in 4.3s and console log done! with async/await..

Please i want to console log "work1" in 3s , console log "work2" in 3s + 500ms , console log "work3" in 3.5s + 800ms and console log "finished work" in the end using async/await in JavaScript...

28th Jul 2021, 9:41 AM
đŸ€–Web GigđŸ€–
đŸ€–Web GigđŸ€– - avatar
3 Answers
29th Jul 2021, 8:45 PM
ODLNT
ODLNT - avatar
+ 2
var time = 0; window.setInterval(function(){ time += 100; (time === 3000) && console.log("work1"); (time === 3500) && console.log("work2"); (time === 4300) && console.log("work3"); }, 100)
28th Jul 2021, 2:26 PM
Coder-Rohit[{(∞)}]
Coder-Rohit[{(∞)}] - avatar
+ 2
Coder-Rohit[{(∞)}] can you do it with Es6 promise.
28th Jul 2021, 6:10 PM
đŸ€–Web GigđŸ€–
đŸ€–Web GigđŸ€– - avatar