let innerArrayOne = [1,"red","fed"]
let innerArrayTwo = [2,"blue","you"]
let innerArrayThree = [3,"green","bean"]
let innerArrayFour = [4,"yellow","fellow"]
let arrayS = [innerArrayOne,innerArrayTwo,innerArrayThree, innerArrayFour]
Here is what I have tried so far
for(let i = 0; i < arrayOfDoom.length; i++){
console.log("----")
console.log(arrayOfDoom[i])
console.log("----")
for(let j = 0; j < arrayOfDoom[i].length;j++)
console.log(arrayOfDoom[i][j])
}
}
Here is the test data I've made. Here is what I have tried so far. That gives you each element in the array.
function loop(count, callback, done) {
let counterForLoop = 0;
let next = function () {setTimeout(iteration, 500);};
let iteration = function () {
if (counterForLoop < count) { callback(counterForLoop, next);
} else { done && done();}
counterForLoop++;
}
iteration();
}
loop(10000, function (i, next) {next();})
loop(9, function (i, nextI) {
console.log("----")
console.log(i)
console.log("----")
loop(3, function (j, nextJ) {
console.log(arrayS[i][j]);nextJ();
}, nextI);});
This is from the only other close StackOverflow I checked. It works, but it ends after the final element in the first array. I don't entirely understand recursion, so every time I have tried to edit, like setting the counter to zero after it hits 8, it breaks it. I would like the output to be
1
red
fed
2
blue
you
....
With one element coming out, every second for one to two minutes, and the loop once it hits the end, it just needs to repeat.
Any ideas or what should I research?