How do you wait time in JS. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you wait time in JS.

For the loading animation, I need to wait time and then move. How do you wait time in JS. https://code.sololearn.com/WKxWvfqDV41C/?ref=app

16th Jun 2020, 10:21 PM
SweepSweep2
SweepSweep2 - avatar
1 Answer
+ 4
Use setTimeout function: var t; setTimeout(function() { t = setInterval(move, 100); },3000); Notice how I passed an anonymous function directly as callback.
16th Jun 2020, 10:35 PM
Kevin ★