I\'m learning JavaScript at the moment on freecodecamp and they have an example for nested for loops in one of their excercises:
var arr = [[1,2], [3,4], [5,6]]
Despite some caveats of using for-in loops on arrays, they can imo sometimes help to clear the mess in nested loops a bit:
var arr = [[1,2], [3,4],[5,6]]; for (i in arr){ for (j in arr[i]){ console.log(arr[i][j]); } }
Also code visualization can clarify execution!