How to get to the value in the object?

  • 0
    I am learning to work with Api metrics, I need to display a list of search phrases to the console, I can display the entire object for now, but I don’t understand how to get to the value.


    fetch(
      'https://api-metrika.yandex.net/stat/v1/data?preset=sources_search_phrases&id=26806923', {
        headers: {
          "Authorization": "OAuth token"
        } 
      })
    .then(function (resp) { return resp.json() })
    .then(function (data) { console.log(data); })
    JavaScript Anonymous, Oct 25, 2020

  • 1 Answers
  • 0
    data.data.flatMap(n => n.dimensions.map(n => n.name))
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!