How to get data from a multidimensional array?

Not much uptake in JS. There is a multidimensional array data obtained via an ajax request roughly like this.
{
"set": {
 "items": [
{
 "path": "path",
 "type": "file",
 "name": "office.doc",
 "size": 278982
},
{
 "name": "1.JPG",
 "path": "path",
 "type": "file",
 "size": 896772
}
],
 "total": 2
},
"type": "dir"
}

Through the cycle of trying to get, such as name
for(var i = 0; i < total; i++) {
 var name = data['set']['items'][i]['name'];

}

If in the cycle to register the console.log(name);in console it will give all as needed, one at a time, but I'm trying to insert into a table using this
$('tbody#parent>tr:gt(0)>td:nth-child(3)').text(name);

In the table, all rows inserted, only the last value of the array
1.JPG
1.JPG
1.JPG
Don't know how much more clear
June 3rd 19 at 19:30
2 answers
June 3rd 19 at 19:32
Solution
You need to iterate through all the table rows and for each one, insert the corresponding value. Now each value you put in all the table rows at once.
$('tbody#parent>tr:gt(0)>td:nth-child(3)').each(function(index) {
$(this).text(data['set']['items'][index]['name']);
});
Got it, thanks - Clarabelle commented on June 3rd 19 at 19:35
June 3rd 19 at 19:34
It so happened that in JS there is no multidimensional array is an object
run it through the keys
var keys = Object.keys(arCartElements);
keys.forEach(function(elementId) {
 var element = arCartElements[elementId];
console.log(element);
});

for infinite vlazhnosti use recursive bypass

Find more questions by tags JavaScriptAJAX