Home >Web Front-end >JS Tutorial >alert interrupt settimeout timing function_javascript skills
After testing, it was found that alert will interrupt the timing function of settimeout. After closing the dialog box, the settimeout time will start again, not from the point of interruption.
For example: settimeout executes a method after 5 minutes, but after waiting for 3 minutes, an alert pops up. After closing the alert, settimeout will start timing again and wait for another 5 minutes instead of 2 minutes.
And as long as it is in the same browser window, even in different frames, alert will interrupt the settimeout in other frames.
Why is it designed like this? I don’t understand. It’s because javascript is single-threaded. Of?
This is what I found in the IE browser. I have not tested other dialog boxes and pop-up boxes.
I really hope that HTML5 will be popularized soon, so that functions that require multi-threading can be solved.