← Back

Promise constructor is executed synchronously

Promise constructor is executed synchronously:

const array = [];
array.push(1);

const promise = new Promise((resolve) => {
array.push(2);
});

array.push(3);

console.log(array)[(1, 2, 3)]; // =>

Source: