2
SetTimeOut and javascript setInterval function application is very wide, they are used to deal with the delay and timing of tasks, such as web pages for some time after opening up a login box, page every so often to send an asynchronous request to obtain the latest data, and so on. But their application is different.
setTimeout () method is used to evaluate the expression or function call after the specified number of milliseconds, while setInterval () is in the specified number of milliseconds every cycle calling function or expression, clearInterval until it clears. That setTimeout () only once, setInterval () can be executed multiple times. The same parameters of the two functions, the first parameter is the code or handler to be executed, and the second is the number of milliseconds delay.