Yo ninjas, in this tutorial I want to teach to you the amazingness of JavaScript timers :). Timers are used all over the show in JavaScript, in anything from popup forms to image sliders. They are a cool feature of JavaScript and well worth mastering if you want to create slightly more advanced interactivity!
The functions we use for JavaScript timers are:
setTimeout()
setInterval()
Any questions, just ask 🙂
SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
========== JavaScript for Beginners Playlist ==========
========== CSS for Beginners Playlist ==========
========== HTML for Beginners Playlist ==========
========== The Net Ninja ============
For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk
========== Social Links ==========
Twitter – @TheNetNinja – https://twitter.com/thenetninjauk
Original source
20 responses to “JavaScript Tutorial For Beginners #42 – JavaScript Timers”
amazing videos, i am so thankful to you. One of the best tutorial videos which i have ever seen, great work.
"counter%4" would be more elegant.
Why did not use a while loop?
how to pause setTimeout?
Thanks for this tutorial, you've helped me finish a project 🙂
Sweet ! I wish you did more simple JS project like this 😀
even modulo will help to reset the counter problem
we usually call/fire functions by putting () at the end, right? like myFunction(). So can some1 explain, why we don't need to put () here —> setTimeout(showMessage, 3000); ?
In the final code we have a function changeColour and var myTimer but why is the block changing color even if we haven't called the change color function….we have just defined it
Can you show us or make a tutorial video on how to make a image slider like this?
these tutorials are really helping me Ninja! Do you have one in JS, that you build a site?
great video !! Thank you !
I have a question , in the end of the demo, after storing the interval function into variable myTimer, you did not call the interval function ( only assigned variable to it) , but the color still changes after you refresh the page . can anyone tell me why?
Let us say when you clicked on the color to stop the cycling, if you wanted your "Timer stopped" text to be in the middle of the color box how would you go about doing that?
How come you don't need parentheses for `showMessage()` when you put it in `setTimeout`?
thanks men i finally understand js
cool
Hi, where to find the source files?
I just realized this whole video is a javascript version of the animation property
Hey Ninja! When I stopped the timer how can I restart it for future shows??
Great tutorials so far man, very helpful. I just have a question for the css portion here. where u have two paddings what does the second one represents? is the first one hight and second one from right. and also the margin, why u have 0 and auto. is zero for the top and auto for centring it?