const index = array.indexOf(item); if (index !== -1) array.splice(index, 1);
var index = array.indexOf(item); if (index !== -1) array.splice(index, 1);
var arr = ['bill', 'is', 'not', 'lame']; arr.splice(output_items.indexOf('not'), 1); console.log(arr) //returns ['bill', 'is', 'lame']
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; var removed = arr.splice(2,2); /* removed === [3, 4] arr === [1, 2, 5, 6, 7, 8, 9, 0] */
const items = ['a', 'b', 'c', 'd', 'e', 'f'] const i = 2 const filteredItems = items.slice(0, i).concat(items.slice(i + 1, items.length)) // ["a", "b", "d", "e", "f"]