HTML/Javascript Egg Timer Game Tutorial

HTML/Javascript Egg Timer Game Tutorial

HTML/Javascript Egg Timer Game Tutorial

Javascript includes two very useful timer functions called setTimeout and setInterval which, respectively, fork off functionality after a time period once and continuously.

Today we use setInterval as the basis of an Egg Timer game. Did you ever teach yourself to count in exact seconds? … via methods like … “one little second”, “two little seconds” or the simpler “one second”, “two seconds” or by listening to (your very healthy, congratulations) heartbeat going at one beat per second? … anyway, you’ll need to have some such method to succeed at this game.

Hopefully you can figure the rules when you click the picture above for a live run, or know that the Egg Timer is initially at some number in its run from 0 to 99 inclusive (and then it starts back at 0 again), and this is shown to you briefly at the start. Also at the start is the Egg Timer position the computer wants you to match when you decide to hit that bottom green guessing button, and you have to be spot on here! You are allowed to peek at the, usually, hidden Egg Timer position, but you have to wait at least 10 seconds between each “Peek”.

Anyway, see how you go with this game of patience and nerve!

Here is a link to some downloadable HTML (with Javascript) programming code you could rename to eggtimer_guess.html

Thanks to Pixabay for their very generous free Clip Art.

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Games, Tutorials and tagged , , , , , , , . Bookmark the permalink.

15 Responses to HTML/Javascript Egg Timer Game Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *