» » setTimeOut

 
Sort articles by: Date | Most Rates | Most Views | Comments | Alphabet

Usage of setTimeOut and setInterval timer in Javascript

Author: bamboo06 on 5-11-2015, 05:15, views: 2913

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.
Usage of setTimeOut and setInterval timer in Javascript

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.

Category: Javascript