I agree! It does seem a little far removed from a real world problem. I think the time aspect is so that setTimeout/Interval is used, which introduces some basic scoping problems.
FWIW given the conditions of the test if someone were to use setInterval I wouldn’t be that impressed. requestAnimationFrame would be way better and even more so Web Animations API. Even then the test is still hunting for a very specific answer that amounts to trivia which should be avoided in test scenarios.
That's a great point Steve. I went ahead and added a requestAnimationFrame version too! 😊
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.