How can I make the program print Work only a specific number of times by and by after specific intervals of time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I make the program print Work only a specific number of times by and by after specific intervals of time?

https://code.sololearn.com/WQOYjS8799Zi/?ref=app Let us take a variable: time=prompt("Enter number of times:") If we enter 2, it Should print: Work 1 after 1 second Work 2

13th Jun 2018, 9:05 AM
B.D
B.D - avatar
1 Answer
+ 9
Use the loop😉😅 https://www.sololearn.com/learn/JavaScript/1140/ <body onload="sayHi()"></body> <script> function sayHi() { for(i=1;i<=10;i++){ document.write("Work! <br>"); } } </script>
13th Jun 2018, 9:10 AM
Jaydeep Khatri
Jaydeep Khatri - avatar