Coding Challenge #66: JavaScript Countdown Timer

[ad_1]
In this video, I use the p5.js library to create a web-based countdown timer. I discuss the native JavaScript method setInterval() and well as p5’s millis().

Support this channel on Patreon:
To buy Coding Train merchandise:

Send me your questions and coding challenges!:

Contact:
Twitter:
The Coding Train website:

Links discussed in this video:
millis() reference:
getURLParams() reference:

Source Code for the all Video Lessons:

p5.js:
Processing:

For More Coding Challenges:
For an Intro to Programming using p5.js:

Help us caption & translate this video!


Posted

in

by

Tags:

Comments

21 responses to “Coding Challenge #66: JavaScript Countdown Timer”

  1. Pritesh Shinde Avatar

    I m using pure JS & it is not running on it
    It isn't showing anything on the screen
    I thought you are using pure JS
    What should I do now??

  2. C Tobias Avatar

    How to make the counter disappear after time is up?

  3. Praveen Chakravarthy Avatar

    Are u using ATOM editor?

  4. Dusan Malusev Avatar

    insted using a new function to calculate min and sec, you could just use
    if (sec == 0) {
            min–;
            sec = 59;
        }
        sec–;
    thats much simpler way

  5. Kerwin Melveda Avatar

    Hi can you tell me what the best platform I can use when coding HTML, CsS and JS?

  6. Joshua Combista Avatar

    dude can you help me?

  7. Kumar Awadhesh Avatar

    hello sir I saw your videos related to java script array I

  8. Leslie Tailor Avatar

    The way you present things is so hilarious & serious the same time 🙂
    Good on you m8 🙂

  9. Osman ın İntikamı Avatar

    How do you combine index.html with sketch.js
    I wrote sketch.js code but I did not see anything when I opened index.html

  10. Aaron Socrates Avatar

    Just wanted to let you know your audio is out of sync with the video play.

  11. GifCo Avatar

    Guys out there coding a playable Snake game in under 10min. This guy takes 20min for a simple explanation of setInterval() lol

  12. Bapak Yulianto Avatar

    thanks bro … learn a lot with "happy coding" every seconds

  13. VEERRAJU YELETI Avatar

    sir can you upload a video on array permutations using backtracking

  14. MORADI IMANE Avatar

    please can you gave me the code source

  15. rey mysterio Avatar

    Very nice tutorial ,good job. I have a challenge how to have multiple countdown timers on a single page

  16. captain marvel Avatar

    cheating u r looking codes from other computer

  17. Alex Avatar

    What is wrong with my code?
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <script>
    var counter = 7202;
    var timeleft = 0;
    function setup(){
    var h = parseInt((counter-timeleft) / 3600);
    var m = parseInt((counter-timeleft) / 60);
    var s = parseInt((counter-timeleft) % 60);
    document.getElementById("counter").innerHTML = h+':'+m+':'+s;
    timeleft++;
    }
    setInterval(setup, 1000);
    </script>
    </head>

    <body>
    <p id="counter"></p>
    </body>

    </html>

    It's output 2 hours : 120 minutes and 2 sec
    If I put 3600 i works

  18. Kcireh Avatar

    i love canvas right

  19. Slick Avatar

    please make a timer in processing.

  20. Darshan Parab Avatar

    On page refresh.. timer will restart…

Leave a Reply

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