How to wait in async await functions in JavaScript

Promise
By Marvin Heilemann · 
Last updated Apr 11, 2019
const timer = ms => new Promise(r => setTimeout(r, ms));

async function doSomething() {
  console.log("Start");
  await timer(2000);
  console.log("Stop");
}

doSomething();
Start
Stop