How Can I Remove a Specific Item From an Array In Javascript using Filter not Split
How Can I Remove a Specific Item From an Array In Javascript ES6 using Filter not Split
How Can I Remove a Specific Item From an Array In Javascript ES6 using Filter not Split
1let valueToBeRemoved = 4;
2let array = [1, 2, 3, 4, 5];
3array = array.filter(item => item !== valueToBeRemoved);
4console.log('array after filter & value is removed", array);
5// [ 1, 2, 3, 5 ]