There is a function that runs every 5 seconds. How to make it so that when you click on the button, the interval is restarted first.
Example: every 5 seconds an alert () is displayed. But as soon as we press a button (for example, at 4 seconds), then we again wait for 5 seconds before a new alert.
An example of an alert output function:
var f = function() { alert("Привет") setTimeout(arguments.callee, 5000); } setTimeout(f, 5000);
setInterval? - Mr. Blackarguments.calleebetter not to use, it is better to give the name of the function and call it by name - Grundy