Iterate Array Backwards and Splice

var a = [1, 2, 3, 4, 5];
for (i = a.length - 1; i > -1; i--) {
    console.log(a, a[i]);
    a.splice(i, 1); 
}
console.log(a);