There is a similar object with arrays

var section = { link: [], filename: [], name: [], author: [], material: [], scale: [], date: [], museum: [], city: [], notation: [], }; 

How can I iterate through its values ​​in a loop to display them (I want to fill the table). Do nested loop? Why is this cycle not working?

 for (property in section) { property['filename'].forEach(function(item) { alert(item); }); } 
  • Well, to go through the internal collection of each child, the nested loop should definitely be - alexoander
  • one
    Maybe because for ... in returns the key (or index) of the object, and not the object itself? - YuS

1 answer 1

property['filename'] - wrong in your case, because property is already a key.

Try something like this:

 for (property in section) { section[property].forEach(function(item) { alert(item); }); } 

PS read more about for ... in

  • Yes, right, thanks! And how can you correctly display them in the table? - Timur Musharapov