How to loop through & display Javascript Multidimensional Array

To return a value in a multidimensional array: array[n][m] is the mth element of the nth row. To do this for every element, use embedded for-loops:

for (var i = 0; i < array.length; i++){
    for (var j = 0; j < array[i].length; j++){
        console.log(array[i][j]);
Share:
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin 2 months

Related