+ 3
How can i make a delay in js?
i want to do something like doSomething() delay(1) doSomethingElse()
2 Answers
+ 11
u can use setinterval or settimeout
+ 5
var timeout = 1000;//timeout in milliseconds
doSomething();
var timer = setTimeout(doSomethingElse, timeout);
here is my countdown web code(I hope it helps you to understend how it works):
https://code.sololearn.com/W5zYPmG4zS8W/?ref=app