JSFiddle - React, Tailwind, and code Playground

by brandondurham

JavaScript

const timeout = ms => new Promise(res => setTimeout(res, ms))

function convinceMe (convince) {
  let unixTime = new Date().getTime()
  console.log(`Delay ${convince} at ${unixTime}`)
  return unixTime  
}

async function delay () {
  let start = convinceMe('started')
  await timeout(5501)
  let end = convinceMe('finished')
  console.log('Diff:', end - start)
}

delay()