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

153
Vistas
Returning variable from response on the end of function in javascript

I have this function:

function settingTextLan(text) {
  fetch("i18n.json")
    .then((response) => response.json())
    .then((data) => {
      text = data[language].translation.test;
    });
  return text;
}
console.log(settingTextLan());

And i want return "text" in current location, But now i get "Undefined". Later i will need to return few values that contains certain texts from JSON file and call them in different places.

How to do it to call that and have access in other places?

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