Call a function in an array foreach loop with nested data
<p>The following obviously doesn't work but it is the goal I am trying to reach:</p>

<pre><code>items.forEach(addData(item.data));
</code></pre>

<p>I know I can do:</p>

<pre><code>items.forEach(function(item){
    addData(item.data)
});
</code></pre>

<p>but I was wondering if there was a shorthand / cooler way of doing this.</p>

<p>edit:</p>

<p>I am also calling the same add data function with an array of items that
aren't nested like so:</p>

<pre><code>items.forEach(addItemId)
</code></pre>

<p>Which is why I was trying to find a way to use the same function (in a similar) fashion for the nested object.</p>