为什么json()返回一个承诺?
fetch()
let url = "http://jsonplaceholder.typicode.com/posts/6";let iterator = fetch(url);iterator .then(response => { return { data: response.json(), status: response.status } }) .then(post => document.write(post.data));;
post.data
Promise
let url = "http://jsonplaceholder.typicode.com/posts/6";let iterator = fetch(url);iterator .then(response => response.json()) .then(post => document.write(post.title));;
post
Object
response.json
qq_遁去的一_1
缥缈止盈
明月笑刀无情
相关分类