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

124
Views
Having a variable list where their names differ only with the last character, how to put them inside an empty array using for loop?

In my react component I have multiple imports like this:

import skill1 from '../../resources/skillIcons/1.svg';
import skill2 from '../../resources/skillIcons/2.svg';
import skill3 from '../../resources/skillIcons/3.svg';
import skill4 from '../../resources/skillIcons/4.svg';
import skill5 from '../../resources/skillIcons/5.svg';

How can I put them all inside an array or object?

const skillsArr = [];

for (let i = 0 ; i < 71 ; i++){
  skillsArr[i]= "skill[i]"  //???
}

Is there some javscript object which contains references to all local variables?

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!