This is what we see in the console first.Ĭonsole.log("This is a pre-show ad reel. Your code may look something like this: const alert = "We are ready start the movie" Add a timer with the delay set to the length of the pre-show. In this file define the variable alert that will tell the movie attendant to start the movie when the pre-show waiting period is up. You are excited, but you're stuck watching the pre-show as the movie attendant is waiting for the cue to run the movie. ![]() Imagine that you are at the movie theatre, and are about to watch a movie. delay: The number of milliseconds to delay before calling callbackĪny additional arguments will be passed to the callback function when it executes.callback: The callback function that needs to be called when the delay time is up.The setTimeout() function takes two main arguments: SetTimeout() is a one-time timer that allows us to schedule code to be run after a certain period of time.Įxample: setTimeout(function, delay,,. ![]() Scheduling a one time callback with setTimeout() Learn how to use setTimeout() and setInterval() in your code and observe execution of their callbacks during the Event Loop execution.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |