JSFiddle - React, Tailwind, and code Playground

JavaScript

async function child() {
    print("child start");
    await new Promise(resolve => setTimeout(resolve, 1));
    print("child end");
}

async function parent() {
    print("parent before");
    await child();
    print("parent after");
}

parent();

function print(string) {
  document.body.innerHTML += string + "<br>";
}