我尝试使用https://newsapi.org新api。
fetch(new Request('https://newsapi.org/v2/top-headlines....')).then(function(response) {
var json = response.json();
console.log(json);//It gives 'Promise {<resolved>: {…}}'
console.log(json.Promise//not work
console.log(json.Promise['[[promiseValue]]']);//not work
});怎样才能得到json.Promise?“[promiseValue]”?谢谢你的答复
发布于 2018-05-29 11:31:24
获取(‘http://example.com/movies.json').then(函数(响应){返回response.json();}) .then(函数(MyJson){ console.log(myJson);});
response.json()给了你一个承诺。
您需要一个新的then函数来获得它的值。
https://stackoverflow.com/questions/50583249
复制相似问题