title: Please explain how this function .reduce works
body: <pre><code>function countInArray(array, value) {
    return array.reduce((n, x) =&gt; n + (x === value), 0);
  }
  console.log(countInArray([1, 2, 3, 4, 4, 4, 3], 4)); // 3
  </code></pre>
  
  <p>I was watching for explanation in manuals, but it seems to me very complex to understand. </p>
  
  <p>So I get that 0 is the starting total, and that x===1 should be equal to 1 or 0 depending on the truth.</p>
  
  <p>I'm mainly confused with n because I read that n is the return value of the previous function, but there's no previous function in the beginning. </p>