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.
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]);
}