⬅️ Execute Program JavaScript Concurrency
new Promise(resolve => resolve(5));
// Async Result:
{fulfilled: 5}
new Promise((resolve, reject) => reject(new Error('it failed')));
// Async Result:
{rejected: 'Error: it failed'}- One important thing to keep in mind: the
resolvefunction that we get from the constructor is separate from thePromise.resolvemethod. And therejectfunction here is separate from thePromise.rejectmethod.