delete in array by value code example
Example 1: js remove from array by value
const index = array.indexOf(item);
if (index !== -1) array.splice(index, 1);
Example 2: remove a value from array js
const index = array.indexOf(item);
if (index > -1) {
array.splice(index, 1);
}