javascript-timers Flashcards
What is a “callback” function?
a callback function is a function that is called in the argument of another function to complete a set of actions
Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?
setTimeout(callback function, delay in milliseconds)
How can you set up a function to be called repeatedly without using a loop?
setInterval(callback function, delay in milliseconds)
What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?
0 seconds
What do setTimeout() and setInterval() return?
setTimeout() and setInterval return an intervalID which can be fed to clearInterval or clearTimeout which will put an early end to the respective functions that were being ran