JavaScript stack overflow solution | Sololearn: Learn to code for FREE!


JavaScript stack overflow solution

I want to write something like this: function f(){ //something setTimeout(f,x); } I'm using setTimeout becouse I want to repeat the function again and again, so I'm afraid of stack overflow. But, what value I ought to write instand of x, if I want to be sure that the code will run at old computers, too, but I want the smallest interval of repeating?

11/7/2019 3:39:46 PM

Dominik Vladař

1 Answer

New Answer


You might want something like: window.requestAnimationFrame(f); This is especially used in animations, where easier to load animations will be loaded faster while intensive animations load slower.