How to remove a specific item from an array in es6
How to remove a specific item 9 from an array arr?
There are different methods which we can use to remove elements from an arraysconst index = arr.indexOf(9);
if (index > -1) { arr.splice(index, 1); }
If we want new array without specific value
const result = arr.filter((item) =>{ return item !== 9;
});
Comments