+ 2
setInterval in JavaScript
Guys, any help on how to time the interval of display in JavaScript? Eg. If i input 5 into my textbox and i submit, it displays 5 cans of coke ALL AT ONCE. How do i get it to show a can every 2 seconds till all 5 are displayed ?
3 Réponses
+ 6
could do something like this
https://code.sololearn.com/Ws03Zz437zT9/?ref=app
+ 5
here's Burey's code with setTimeout variation
https://code.sololearn.com/WU8Dw46c6gOz/?ref=app
+ 4
could use either setInterval:
setInterval (function (){
//Ur task here
}, 2000);
or can use setTimeout , with delay for each task :
setTimeout ( function (){
// Ur task here
}, 2000);