title: How to select elements from an array based on the indices of another array in JavaScript?
body: <p>This works, but I'm wondering if there is a better way to filter by index:</p>
  
  <pre><code>a = [10,20,30,40]
  b = [1,3]
  a.filter((x,i) =&gt; b.includes(i))
  // [20, 40]
  </code></pre>