Day 99: Looping Through an Array and Removing Items

While working through an algorithm problem on freeCodeCamp, I cam across something interesting. I was trying to loop through an array and remove certain items that didn't pass a specific requirement. For example, removing all the odd numbers. In order to do this, I used a For Loop and the split() method. In theory it should work, however I noticed that if there were ever 2 even numbers in a row, the second one was not removed. After looking into this, it turns out once an item is removed, the array is re-indexed. This causes the loop to skip the next item without checking it. I wrote an article about it and should have it posted on Medium and DevTO soon!