How to make a function that will be repeated indefinitely? Как сделать функцию которая будет повторяться до бесконечности? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to make a function that will be repeated indefinitely? Как сделать функцию которая будет повторяться до бесконечности?

How to make a function that will be repeated indefinitely (in JS)? Как сделать функцию которая будет повторяться до бесконечности (в JS)?

30th Apr 2018, 9:01 AM
agurg
agurg - avatar
2 Answers
+ 2
call the function inside the function. or you can also use - set Interval(function_name, 200); 200 is in millisecond. 2000 - 2 second. Search for recursion if wanna know why/how it works.
30th Apr 2018, 10:06 AM
Akib
Akib - avatar
+ 1
That is known as Recursion, calling a function inside another one. You need to have a base condition, else it runs indefinitely. Here's an example... https://code.sololearn.com/cbhHAgTB4xjx/?ref=app
30th Apr 2018, 11:59 AM
Aaron Stone
Aaron Stone - avatar