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 freelance PHP, MySQL, HTML5, CSS3, JavaScript, Java, Python and C# programmer. He also do graphics design, video editing, visual effects, animation, 3D modeling and making games.

Related Post

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