If you want to call a function after a specific amount of time, just like using a timer, you can call setTimeout() or setInterval() function.

setTimeout() is for single execution, and setInterval() will run repeatedly after we stop it.

Here is two video tutorial about setTimeout() and setInterval() and in the end of this post you can see the source code you see in the video.

Source code:

Habibie is an Indonesian Java, C#, PHP, MySQL, HTML5, CSS3 & JavaScript programmer. He is also a good graphic designer, video editor, animator and 3D modeler.

Related Post

JavaScript setTimeout() and setInterval() tutorial
Tagged on: