整合到一起,作为参考:
//2 5 3 4 1 //2 5 3 1 4 var img = new Image(); img.src = '.'; img.onerror = function() { console.log(1); }; console.log(2); Promise.resolve().then(() => console.log(3)); setTimeout(() => console.log(4), 0); Promise.resolve(console.log(5));