📜  成功和失败回调函数js - Javascript代码示例

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

代码示例1
const {checkInventory} = require('./library.js');

const order = [['sunglasses', 1], ['bags', 2]];

// Write your code below:
const handleSuccess = (resolvedValue) => {
  console.log(resolvedValue);
}

const handleFailure = (rejectedReason) => {
  console.log(rejectedReason);
}

checkInventory(order).then(handleSuccess, handleFailure);