What is the deferred statement of javascript
This article mainly explains "what is the delay sentence of javascript". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the delay sentence of javascript".
The deferred statement for javascript is "setTimeout (function () {remind ();}, 5000);" or "setInterval (function () {remind ()}, 5000);".
This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.
What is the deferred statement of javascript?
JavaScript delay function
1. SetTimeout function
SetTimeout (function () {remind ();}, 5000); / / the remind () function will be called in 5 seconds.
2. SetInterval function
Var interval;interval = setInterval (function () {remind ()}, 5000); / / 5 seconds cyclic call to execute remind () function clearInterval (interval); / / clear delay program
3. An example found
Var timer;if (login.state! = = undefined) {if (login.state) {var fen = login.info.fen; var xianbey = login.info.xianBey clearTimeout (timer); / / clear delay program}} else {timer = setTimeout (arguments.callee, 1) / / delay loop execution itself} Thank you for your reading. The above is the content of "what is the deferred sentence of javascript". After the study of this article, I believe you have a deeper understanding of what the deferred sentence of javascript is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!