setTimeout

  • setTimeout takes a function as its first parameter...
  • ...and a number of milliseconds as its second
  • JavaScript schedules the function to run after that many milliseconds
function logHello() {
    console.log("Hello")
}

setTimeout(logHello, 3000); // Logs "Hello" in 3000 ms (3 sec)

7 / 27