Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
¿Cómo puedo sacar a y b de la matriz?

Soy bastante nuevo en la programación, estaba tratando de crear una llamada API que usaré en otra función, pero estoy atascado aquí. Necesito obtener a y b por separado y como valor de esto:

 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);

¿Cómo puedo hacerlo? Ya eché un vistazo al alcance, el bloqueo y la desestructuración, pero realmente no puedo encontrar una salida. ¡Gracias por tu ayuda!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Deje que la función principal devuelva la promesa y al resolver esa promesa obtendrá a y b

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!