Remove a specific element from an array can be done in one line with the filter option, and it's supported by all browsers: https://caniuse.com/#search=filter%20array
function removeValueFromArray(array, value) {
return array.filter(e => e != value)
}
I tested this function here: https://bit.dev/joshk/jotils/remove-value-from-array/~code#test.ts