182k views
5 votes
Which statement will call a function animate every 50 milliseconds?

a) setTimer(animate, 50);
b) setInterval(animate, 50);
c) setTimeout(animate, 50);
d) callFunction(animate, 50);

User Drita
by
7.8k points

1 Answer

1 vote

Final answer:

The correct statement to repeatedly call a function every 50 milliseconds is setInterval(animate, 50).

Step-by-step explanation:

The statement that will call a function named animate every 50 milliseconds is b) setInterval(animate, 50). The setInterval function is used to call a function or execute a code snippet repeatedly with a fixed time delay between each call. This function will continue to call animate every 50 milliseconds until clearInterval is used to stop it.

User Kgibm
by
8.2k points