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 to apply a method to an array/variable with the help of an index?

I'm struggling with something somehow basic :)

As you can see in this line of code, I use an index (i) to select a certain value inside an array:

tiles[i].addChild(block);

and I would like to be able to do the same, but to push something into an array, on this line:

tile0Content.push(block.identifier);

I don't know how to do this, but I imagine something like this (with i instead of 0):

tileiContent.push(block.identifier);

I could of course manually copy paste my code but it's very unpractical + my index will vary depending on situations so it would be very VERY practical to be able to push values inside my arrays using an index :)

thx to everyone reading my post <3

EDIT: I think my post isnt perfectly clear on what I want to accomplish, but I could sum it up like this: Instead of doing:

tile0Content.push(block.identifier);
tile1Content.push(block.identifier);
tile2Content.push(block.identifier);

I would like to do:

for(var i = 0;i<myIndex.length;i++){
tileiContent.push(block.identifier);
}
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