JSFiddle - React, Tailwind, and code Playground

by rakesh makluri

JavaScript

function who() {
	console.log('inside who');
  return new Promise(resolve => {
    setTimeout(() => {
      resolve('🤡');
    }, 200);
  });
}

function what() {
	console.log('inside what');
  return new Promise(resolve => {
    setTimeout(() => {
      resolve('lurks');
    }, 300);
  });
}

function where() {
	console.log('inside where');
  return new Promise(resolve => {
    setTimeout(() => {
      resolve('in the shadows');
    }, 500);
  });
}

async function msg() {
  const a = await who();
  	console.log('after who');
  const b = await what();
  	console.log('after what');
  const c = await where();
  	console.log('after where');

  console.log(`${ a } ${ b } ${ c }`);
}

msg();