JSFiddle - React, Tailwind, and code Playground
by soulwire
Babel + JSX
async function wait(ms) {
return new Promise(r => setTimeout(r, ms))
}
const uris = [1,2,3]
async function test() {
return urls.reduce(async (memo, uri) => {
if (uri === 2) {
await wait(1000);
return memo.concat('hi')
}
return memo.concat(uri);
}, [])
}
(async () => {
})()
const result = await test()
console.log(result)