I have array with 44 elements. I want to output these elements in two different columns. First 32 elements should be in Table 1 and other 12 should be in Table 2. I would like to use one for loop for this if possible. So far I only found solution that required two for loops. Basically I would use .slice(). First loop will loop through myArray.slice(1,32) and second myArrat.slice(32,44). Here is my code:
var myArray = [1,2,3,4,5,6,7,8,....44];
for (var i = 0; i < myArray.slice(1,32); i++) {
console.log(myArray[i]);
}
for (var i = 0; i < myArray.slice(32,44); i++) {
console.log(myArray[i]);
}
Is there a way to do this in one loop? I would like to put them in two different dynamic created tables. Thanks in advance.
i < myArray.slice(1,32)will likely always be false.