How to use SetTimeout in JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • In this video we are going to learn about the javascript setTimeout method. The setTimeout method allows you to set a timer and then execute a function at the end of that timer. The setTimeout timer can be canceled by calling clearTimeout and passing in the setTimeOut id(TimerId)
    To help us better understand the setTimeout method we will explore the function itself and also build a sample application.
    The sample application is really simple. Pressing the change color button will disable the button and start a timer. At the end of the timer the button will be re-enabled and the box in the center of the screen will change color. The timeout will be on a 2 second delay. To cancel the timer we will have a cancel button which will invoke the clearTimeout method passing in the timerID.
    GitHub
    github.com/Cod...
    MDN
    developer.mozi...

ความคิดเห็น • 12

  • @harvard004
    @harvard004 2 ปีที่แล้ว +4

    Thank you. Clear instructions. Perfect talking speed.

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +2

      You’re welcome! Thank you! I’m happy you enjoyed the video!

  • @0997udan
    @0997udan 2 ปีที่แล้ว +2

    I subed to you when you had 606 sub, I was the 607. I thought "poor channel, great exclamation, I'll sub.". Well, I did my part. Good luck and I wish you 10,000 k subs.

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +1

      Thank you ole rya! I’m really happy to be above 1000 subscribers. Thank you for subscribing and being a part of that milestone! Looking forward to hitting 10k one day!

  • @Awerd64
    @Awerd64 2 ปีที่แล้ว +3

    Bodacious video dude !
    Keep it up your videos are really clear and informative even a french like me manages to understand
    By the way,
    Is Adam your Real name ?

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +2

      Thank you! Glad you enjoyed the video. Yes my name is Adam!

    • @Awerd64
      @Awerd64 2 ปีที่แล้ว +3

      @@CodingWithAdam
      So do I, lol
      Is it a coincidence ?
      Anyway, Very erelong could you make a video about how to code a 2D shoot'em up like 80's in pure JS
      Thanks

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +2

      @@Awerd64 It's a great name! I'm in the process of making a space invaders tutorial in pure JS. It should be a fun tutorial! If everything goes to plan I hope to get it done with in the next month or so.

    • @Awerd64
      @Awerd64 2 ปีที่แล้ว +2

      @@CodingWithAdam thanks and have you done a video about how to make a title screen in JS ?

  • @arabadunyas4698
    @arabadunyas4698 2 ปีที่แล้ว +3

    Hello, amazing quality content thank you very much. BTW whats your microphone for recording audio for tutorials? It sounds so good wow.

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +3

      Thank you! I appreciate the feedback on the content and audio quality. The mic that I used for this video is the AT2020USB+. I would also recommend the Blue Yeti. They are really easy to use since all they require is a usb connection.

    • @arabadunyas4698
      @arabadunyas4698 2 ปีที่แล้ว +2

      @@CodingWithAdam Thanks!