JSFiddle - React, Tailwind, and code Playground
by Artem
JavaScript
'use strict';
function bar() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(10);
}, 1000);
});
}
async function foo(displayFunc) {
let result = await bar(1).then(displayFunc);
// let result = await bar(1).then(function() {return 10;});
// console.log('Done: ', result);
}
foo(alert);