title: Split an array by its index
body: <p>Suppose I have an array:</p>
  
  <pre><code>var ay=[0,1,2,3,4,5,6,7,8,9];
  </code></pre>
  
  <p>Now I want to get two array:</p>
  
  <pre><code>var ay1=[0,2,4,6,8];
  var ay2=[1,3,5,7,9];
  </code></pre>
  
  <p>What is efficient way?</p>
  
  <hr>
  
  <p>Update:</p>
  
  <p>I know the simple loop and modulo operator method(as <code>elclanrs</code> said) like this:</p>
  
  <pre><code>var ay1=[],ay2=[];
  for(var i=0,len=ay.length;i++){
    if(i%2==0){
      ay2.push(ay[i]);
    } else 
      ay1.push(ay[i]);
  }
  </code></pre>
  
  <p>But I just wonder if there is any other efficient  or cool way I do not know yet.</p>
  
  <p>That is why I ask this simple question. I am not asking how to do , I am asking how to do better if possible!</p>
  
  <p>So I do not think this post deserved the down-votes.</p>