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

171
Vistas
How do I export the output of an async function?

I am running the following code. Where I am expecting to see the outputs latitude and longitude, what I get is Promise{<pending>} in my console. Why is this the case? I thought using async/await helps to eliminate the problem of pending promises since the code can't go forward until the promise fulfills. How do I solve this problem?

const issURL = 'someUrl';
async function getData() {
            const res = await fetch(issURL);
            const data = await res.json();
            const {
                latitude,
                longitude
            } = data;
            return (latitude, longitude);
        }
console.log(getData());

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Since the getData() function needs some time to resolve its promise, you have to await it as well. Alternatively, you can use getData().then((res) => console.log(res))

about 4 years ago · Juan Pablo Isaza Denunciar
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