title: Javascript: How to clear undefined values from an array
body: <p>I'm trying to loop through an array and delete and skip the elements until only one is existing. i've tried splicing but it messes up my loop because the element from arr[1] then becomes arr[0] etc.</p>
  
  <p>Let's say there are 10 people. I'd like to remove person 1 then keep person 2 then remove person 3 and keep person 4. This pattern will go on until only one is left. </p>
  
  <p>any kind of help will do.</p>