title: match two arrays into one array. Not through the for loop
body: <p>I have two arrays </p>
  
  <pre><code>var arrayA = [false, false, false, false, false]
  var arrayB = [1,2,3]
  </code></pre>
  
  <p>Array B holds the index of array A.
  For example, the first object of array B is 1. Means that the value of the array A index is 1 to be changed</p>
  
  <p>Now I want to create a <code>newArray: [false,true,true.true,false]</code></p>
  
  <p>How to make it? Thanks in advance.</p>
  
  <p>One way is 2 for loops. Is there a simpler and more efficient method?</p>