console.log(1) setTimeout(() => { console.log(2) }) new Promise((resolve, reject) => { console.log(3) setTimeout(() => { reject() }, 1) }).then(() => { console.log(4) }).catch(() => { console.log(5) }) var $ajax = new XMLHttpRequest() $ajax.open('get', 'http://yapi.demo.qunar.com/mock/5691/app') $ajax.send(null) $ajax.onreadystatechange = function() { if ($ajax.readyState == 4) { if ($ajax.status == 200) { console.log(6) } } }