setInterval and setTimeout: timing events – Beau teaches JavaScript

setTimeout and setInterval are timing events in JavaScript that both allow execution of code at specified time intervals. This quick tutorial shows how to use them.

💻 Code:

🐦 Beau Carnes on Twitter:

⭐JavaScript Tutorials Playlists⭐
▶JavaScript Basics:
▶Data Structures and Algorithms:
▶Design Patterns:
▶Clean Code:

Learn to code for free and get a developer job:

Read hundreds of articles on technology:

And subscribe for new programming videos every day:


This Post Has 23 Comments

  1. dekat win

    Just asking to be sure, so set timeout as well as set interval are counting asynchron right ? so i can run othere code while they are sill counting ? Becouse i need somethink like that.

  2. kryyystalball

    'it says hello but it never says goodbye'.
    damn that unexpectedly hit some feelings

  3. Harvester

    Can I stop BLOATWARE this way? If it is possible could you make a video about it?

  4. Kpodji Emmanuel

    i have exams in two hours and you just nailed it. Thanks very much. i watched the video once and just understood everything.👌

  5. Alii

    thanks, I miss the nested settimeout…

  6. ch vishnu

    The given below URL cantians 20 seconds n 120 seconds countdown timer please provide a script 20 to 5 seconds n 120 to 5 or 10 seconds

  7. ch vishnu

    120 to direct 5 seconds countdown timer script provide me Sir

  8. Vitor Peixoto

    I've a question, does setInterval affect the performance of a website?

  9. J3fro C

    So for setTimeout, you perform a function after a certain period ONCE? But with setInterval, you perform a function after a certrain period of time …but does it indefinitely? Is that correct to my understanding?

  10. hwwn

    Thanks Beau, tu es très beau!

  11. Telmo Sampaio

    Thanks Beau, I always used to confused both of this terms 🙂

Leave a Reply