Week 5 — 7 / 38

setTimeout

The simplest way to make javascript asynchronous is with setTimeout. Its semantics are "wait this long in the background, then run this function."

let myGreeting = setTimeout(function () {
  console.log("Hello!");
}, 2000);
console.log("Howdy!");

Output:

Howdy!
Hello!