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

187
Views
How to call the next variable in loop?

I need that every time that loop the FOR in JavaScript, it call the next variable. Example:

var variable1 = '1';
var variable2 = '2';
var variable3 = '3';

    for(i=0;i<3;i++){
console.log(variable+(+1));
}

Result that I want:

1
2
3

But my way don't work.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to put the variables in an array if you want to iterate over them with a for loop.

ie: var items = ['1', '2', '3']

Then you can restructure your loops as...

for (let i = 0; i < items.length; i++) {
  console.log(items[i]);
}
about 4 years ago · Juan Pablo Isaza Report
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!