'How can I get a and b out of the array? [duplicate]

I'm pretty new to programming, I was trying to built an API call that I will use in another function but I'm stuck here. I need to get a and b separately and as value out of this:

import axios from "axios";

async function main() {
  await axios
    .get('https://api.blocknative.com/gasprices/blockprices?confidenceLevels=99', {
      headers: {
        Authorization: 'key'
      },
    })
    .then(function(response) {
      const a = response.data.blockPrices[0].estimatedPrices[0].maxFeePerGas;
      const b = response.data.blockPrices[0].estimatedPrices[0].maxPriorityFeePerGas;
      return [a, b]
    });
};

main().catch(console.error);

How can I do it? I already take a look at scope,block and destructuring but I really can't figure a way out. Thanks for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source