📜  什么是承诺 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:09.535000             🧑  作者: Mango

代码示例6
const promise1 = new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('foo');
  }, 300);
});

promise1.then((value) => {
  console.log(value);
  // expected output: "foo"
});

console.log(promise1);
// expected output: [object Promise]