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

282
Vistas
Pushing Function Array into ;Another Array

I am developing a recipe website in which I am using an API to pull in ingredients and nutritional information. On my site, I am wanting to have a person search to add ingredients from this and only this list. I'm pretty green with javascript, so this likely is user error. What I've found so far is this:

const api_url = `https://reqres.in/api/users`;
const matchList = document.getElementById('results');

function getData(){
    fetch(api_url).then(response =>{
        return response.json();
    }).then(data =>{
        const html = data.data.map(user =>{
            return `"${user.first_name}"`
        }).join(',');
        console.log(html);
    });
};

let suggestions = [
    "Taco",
];

I'm needing the "let suggestions = []" for a different piece of code, but I'm unable to capture the array that is found in the getData() function. Any thoughts on how to go about this?

about 4 years ago · Santiago Trujillo
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