📜  js 承诺 - Javascript 代码示例

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

代码示例6
const prom = new Promise((resolve, reject) => {
  resolve('Yay!');
});
 
const handleSuccess = (resolvedValue) => {
  console.log(resolvedValue);
};
 
prom.then(handleSuccess); // Prints: 'Yay!'