1var colors = ["red","blue","car","green"];
2var carIndex = colors.indexOf("car");//get "car" index
3//remove car from the colors array
4colors.splice(carIndex, 1); // colors = ["red","blue","green"]
1var index = array.indexOf(item);
2if (index !== -1) array.splice(index, 1);
1var arr = ['bill', 'is', 'not', 'lame'];
2
3arr.splice(output_items.indexOf('not'), 1);
4
5console.log(arr) //returns ['bill', 'is', 'lame']
1var index = array.indexOf(item);
2if (index !== -1) {
3 array.splice(index, 1);
4}
5
1const items = ['a', 'b', 'c', 'd', 'e', 'f']
2const i = 2
3const filteredItems = items.slice(0, i).concat(items.slice(i + 1, items.length))
4// ["a", "b", "d", "e", "f"]
5