Skip to content

Latest commit

 

History

History
15 lines (9 loc) · 222 Bytes

File metadata and controls

15 lines (9 loc) · 222 Bytes

对 promise 调用两次 resolve?

下列这段代码会输出什么?

let promise = new Promise(function(resolve, reject) {
  resolve(1);

  setTimeout(() => resolve(2), 1000);
});

promise.then(alert);