JSFiddle - React, Tailwind, and code Playground
by Abdul Ahmad
JavaScript
function asyncOne() {
return new Promise((res, rej) => {
setTimeout(() => {
res('one');
}, 3000);
});
}
function asyncTwo() {
return new Promise((res, rej) => {
setTimeout(() => res('two'), 3000);
});
}
function asyncThree() {
return new Promise((res, rej) => {
setTimeout(() => res('three'), 3000);
});
}
asyncOne().then(asyncTwo).then(r => {
console.log(r);
});