undefined output with Array.prototype.reduce : <p>Why the following code produce undefined as output?</p>

<pre><code>function sumAll(arr) {  
  arr.reduce( (a, b) =&gt; a + b );
}
sumAll([1,2,3,4]);
</code></pre>



<p>While if i run this code without the function like this:</p>

<pre><code>var arr = [1,2,3,4]; 
arr.reduce( (prev, curr) =&gt; prev + curr );
</code></pre>

<p>it works properly and produce 10 as sum of all elements.</p>

<p>What's wrong with the first one? I'm pretty new to JS that's why i can't figure it out what's wrong with the first one.</p>

<p>Thanks in advance for the help.</p>
