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

145
Vistas
my swift-executing functions are skipping over values

I'm working with an API in JS to create a movie info website and I'm calling an async function 3 times that fetches different endpoints based on the parameters I pass in.

I mapped across each object(value) in the 'result'(property of parsed response) array in order to set it's respective 'poster-path' property value as the respective image element's src attribute. it worked fine, but since i called the function thrice, anytime I try to target the object whose index is equal to that of my target image element, it seems to target only the objects gotten in the final function call.

    let result = res.json().result
    let imageID = e.target.data-id;
    let targetObject = result[imageID];

if I try to access targetObject's movie ID property for example, and the e.target is the image with an index of 0 in the first movie display(result of the first function call), rather than targetting the targetObject with an index of 0 in the same first movie display, it will target the object with an index of 0 in the third movie display.

Please how do I target the object with the same index as my e.target and in the 'same' display without it being overridden by the last. I'm very sorry if I didn't word this correctly, I'm still new to programming.

almost 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