Javascript Promise
<script>
const sexy = new Promise((resolve, reject) => {
setTimeout(resolve, 3000, "good");
setTimeout(reject, 4000, "bad");
});
sexy
.then(result => console.log(result))
.catch(error => console.log(error)); // output : "good"
const mango = new Promise((a, b) => a(2));
mango.then(num => num * 2).then(otherNum => console.log(otherNum * 2));//output : 8
</script>