Array intersection (set-theoretic) with Array.prototype.reduce
<p>I have two arrays <code>[a,b,c,d]</code> and <code>[b,d,f,h]</code>.</p>

<p>I want to get an array back with the common elements <code>[b,d]</code>.</p>

<p>I can achieve that with a combination of <code>filter</code> and <code>indexOf</code>:</p>

<pre><code>[a,b,c,d].filter(el =&gt; [b,d,f,h].indexOf(el) !== -1)
</code></pre>

<p>but I was wondering if and how I can do the same with <code>reduce</code>.</p>

<p>I admit that, despite looking at many examples, <code>reduce</code> still is to me one of the most obscure JS methods, so I'd really appreciate some advice.</p>