Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!