nodejs remove value from array code example
Example 1: remove a value from array js
const index = array.indexOf(item);
if (index > -1) {
array.splice(index, 1);
}
Example 2: nodejs remove element from array
function arrayRemove(arr, value) {
return arr.filter(function(ele){
return ele != value;
});
}
var result = arrayRemove(array, 6);
// result = [1, 2, 3, 4, 5, 7, 8, 9, 0]