JSFiddle - React, Tailwind, and code Playground
by ksoncan34
HTML
<pre id="log">
</pre>
JavaScript
const log = document.getElementById('log');
log.innerText += "Startup\n";
function TestWait() {
return new Promise(resolve => {
log.innerText += "TestWait\n";
setTimeout(() => {
resolve();
}, 1000);
});
}
async function Test() {
log.innerText += "Test\n";
await TestWait();
return new Promise(resolve => {
resolve(1);
});
}
Test().then(res => {
console.log('res', res);
});