Sobes.tech
Junior — Senior

Promise behavior with multiple resolve and reject calls

livecode

Task condition

Analyze what happens to a Promise object if the functions resolve() and reject() are called multiple times in a row.

new Promise((resolve, reject) => {
  resolve(1);
  resolve(2);
  reject('error');
}).then(
  (value) => {
    console.log(value);
  },
  (error) => {
    console.log('error');
  }
);

Describe what will be output to the console and why subsequent calls to resolve/`reject`` do not affect an already settled promise.