This is how i achieved this, obviously there are better implementations or simpler ones
function except(array,excluded) {
console.log(array.filter((item) => excluded.indexOf(item) === -1));
}
the function except expects the original array and the values user wants to remove,
according to MDN filter method creates a new array with all elements that pass the test implemented by the provided function.
In our case the provided function is the indexOf(item) , where -1 means if not equal to, so the filter function is filtering values after removing those that are in excluded array.
So the output we see is:
Array(3) [ 4, 2, 3 ]