javascript remove items from left to right code example
Example 1: removing first item array js
var list = ["bar", "baz", "foo", "qux"];
list.shift()//["baz", "foo", "qux"]
Example 2: js remove if
ar = [1, 2, 3, 4];
ar = ar.filter(item => !(item > 3));
console.log(ar) // [1, 2, 3]