Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

79
Vistas
Using fetch to log/output json values

I'm trying to fetch values from JSON, see below. I need the values for the very last "year", "month", "day", "cycle", "trend" in the object

{"co2":[{"year":"2012","month":"1","day":"1","cycle":"392.92","trend":"391.50"},
...
,{"year":"2022","month":"2","day":"20","cycle":"418.63","trend":"416.80"}]}

I've tried the following script, but it logs [object Object]. Any ideas? Thanks in advance.

    async function loadnums() {
        const response = await fetch('https://global-warming.org/api/co2-api');
        const nums = await response.json();
        console.log(nums); 
    }
    loadnums();

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda