mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-05 14:28:31 +00:00
[javascript/en] Added setInterval
Added the setInterval function provided by most browsers
This commit is contained in:
parent
f4c1f3d947
commit
8b9c5561e7
@ -310,6 +310,12 @@ setTimeout(myFunction, 5000);
|
|||||||
// Note: setTimeout isn't part of the JS language, but is provided by browsers
|
// Note: setTimeout isn't part of the JS language, but is provided by browsers
|
||||||
// and Node.js.
|
// and Node.js.
|
||||||
|
|
||||||
|
// Another function provided by browsers is setInterval
|
||||||
|
function myFunction(){
|
||||||
|
// this code will be called every 5 seconds
|
||||||
|
}
|
||||||
|
setInterval(myFunction(), 5000);
|
||||||
|
|
||||||
// Function objects don't even have to be declared with a name - you can write
|
// Function objects don't even have to be declared with a name - you can write
|
||||||
// an anonymous function definition directly into the arguments of another.
|
// an anonymous function definition directly into the arguments of another.
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user