I am working with a 2-dimensional array called albumPhotos[x][y]
. Each row represents a different photo album
, and each column contains a link to a photo
.
Since each photo album
may have a different number of photos
, the length of each row
in this array varies.
I'm attempting to determine the length of each row in the array, essentially finding out how many columns are in each one. How can I achieve this using JavaScript?
I initially tried:
for(var i=0; i< numberOfRows ; i++)
for(var x=0; x < albumPhotos[i].length; x++) ...
However, it seems like this is not the correct syntax in JavaScript. Then, I attempted something like this:
for(var i=0; i< numberOfRows ; i++)
for(var x=0; x < albumPhotos.rows[i].cells.length; x++)
Yet again, this approach appeared to be incorrect. It seems more suitable for HTML tables rather than arrays.
Does anyone have any ideas on how to solve this problem?