The following obviously doesn't work but it is the goal I am trying to reach:
items.forEach(addData(item.data));
I know I can do:
items.forEach(function(item){
addData(item.data)
});
but I was wondering if there was a shorthand / cooler way of doing this.
edit:
I am also calling the same add data function with an array of items that aren't nested like so:
items.forEach(addItemId)
Which is why I was trying to find a way to use the same function (in a similar) fashion for the nested object.
items.forEach(item => addData(item.data));.dataproperty of every element of the array?addDatafunction to look for.data:P