title: I need to split an array into N number of arrays based on searching for an element from another array
body: <p>I need to split an array into N number of arrays based on searching for an element from another array.</p>
  
  <p>consider this scenerio</p>
  
  <pre><code>var test = ["1","2","3","env","6","7","8","uat","2344","wersdf","sdfs"];
  var test2=["env","uat"];
  </code></pre>
  
  <p>now I want a map like</p>
  
  <pre><code>{
  env:["6","7","8"],
  uat:["2344","wersdf","sdfs"]
  }
  </code></pre>
  
  <p>Note that the array items in test2 and test1 is dynamic.But two test2 values will not be coming one after another in the test array, there will be some items between it.</p>