whatwg-fetch中fetch得到的response调用的.json()得到的数据类型是什么?

fetch('/users.html')

  .then(function(response) {

    return response.text()

  }).then(function(body) {

    document.body.innerHTML = body

  })    fetch('/users.json').then(function(response) {

      console.log(response.headers.get('Content-Type'))

      console.log(response.headers.get('Date'))

      console.log(response.status)

      console.log(response.statusText)

    })

上面是官方文档给的例子response.text()得到的是什么?.text()方法是在哪里定义的?


fetch('/users.json')

  .then(function(response) {

    return response.json()

  }).then(function(json) {

    console.log('parsed json', json)

  }).catch(function(ex) {

    console.log('parsing failed', ex)

  })

response.json()得到的是什么?.json()方法是在哪里定义的?

慕妹3146593
浏览 3035回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript