node.js中接收一个promise对象

// 第一种:用async、await修饰
async function a() {
 let b = await crawer("参数");
  console.log(b);
}
a();
// 第二种:用.then接收
let b = crawer("参数")
  .then((res) => {
    console.log(res);
  })
  .catch((e) => {
    console.log(1);
  });

 

posted @ 2021-04-30 22:13  yw3692582  阅读(299)  评论(0编辑  收藏  举报