+ 3

How can i make a delay in js?

i want to do something like doSomething() delay(1) doSomethingElse()

17th May 2018, 12:58 PM
Etabeta1🇼đŸ‡č
Etabeta1🇼đŸ‡č - avatar
2 Answers
+ 11
u can use setinterval or settimeout
17th May 2018, 1:06 PM
Ebubekir TĂŒrker
Ebubekir TĂŒrker - avatar
+ 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
17th May 2018, 1:07 PM
Dmitriy
Dmitriy - avatar