Node.js/Buffer

来自康健生活
Kangkk​(留言 | 贡献)2020年2月23日 (日) 07:45的版本 (创建页面,内容为“== 状态 == {| class="wikitable" |- | fulfilled || 已成功 |- | pengding || 进行中 |- | rejected || 已拒绝 |} === 参数 === {| class="wikitable" |- | reslo…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

状态

fulfilled 已成功
pengding 进行中
rejected 已拒绝

参数

reslove 示例
reject 示例

示例

标题文字 标题文字 标题文字
习题 示例 示例
示例 示例 示例
示例 示例 示例

传参

1.

promiseDemo.then((result) => {
  console.log(result)
}, (result) => {
  console.log(result)
})

2.

promiseDemo.then((result) => {
  console.log(result)
}).catch((result) => {
  console.log(result)
})

3.

promiseDemo.then((result) => {
  console.log(result)
})   //只接收成功状态

promiseDemo.catch((result) => {
  console.log(result)
})    // 只接收失败状态,可以看成第三种的简写形式

promiseDemo.then(null, (result) => {
  console.log(result)
})   //只接收失败状态

调用

错误链式调用

错误处理机制