第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

當(dāng)我解決一個承諾時,我的函數(shù)沒有被調(diào)用

當(dāng)我解決一個承諾時,我的函數(shù)沒有被調(diào)用

慕村225694 2021-06-22 21:08:42
我的函數(shù)residents()從API返回一個數(shù)組,函數(shù)getTatooineResidents()應(yīng)該創(chuàng)建一個新的promise,當(dāng)promise被解決時執(zhí)行residents()const superagent = require('superagent')const residents=()=>{    superagent.get('https://swapi.co/api/planets/1/')                        .then(res => console.log(res.body.residents))                        .catch(err => console.log(err))    return residents                         }residents()const getTatooineResidents=()=>{    return new Promise((resolve, reject) => {        if(3 > 2) resolve(residents())//instead of executing residents() it just writes the body of the function        reject('I am broken!')      })}當(dāng)我調(diào)用 getTatooineResidents() 時,它不是執(zhí)行函數(shù)residents(),而是返回函數(shù)的主體,當(dāng)我解析promise 時,括號不應(yīng)該調(diào)用函數(shù)嗎?AssertionError [ERR_ASSERTION]:           The function should a return promise which resolves with an array of urls for the residents of Tatooine like :         [array of URLS]           the promise that was returned from you function resolved with: ()=>{    superagent.get('https://swapi.co/api/planets/1/')                        .then(res => console.log(res.body.residents))                        .catch(err => console.log(err))return residents                         }
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 142 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號