JSFiddle - React, Tailwind, and code Playground
JavaScript
async function someAsyncFunction(value) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(`Promise resolved`)
}, 100)
})
}
const values = [100, 200, 300];
const testFunction = async () => {
return await Promise.all(
values.map(async (val) => {
return await someAsyncFunction(val);
})
);
}
const run = async () => {
const test = await testFunction();
console.log(test);
}
run();