javascript remove all instances of multiple values from array code example

Example 1: javascript removing items looping through array

var colors=["red","green","blue","yellow"];
//loop back-words through array when removing items like so:
for (var i = colors.length - 1; i >= 0; i--) {
    if (colors[i] === "green" || colors[i] === "blue") { 
        colors.splice(i, 1);
    }
}
//colors is now  ["red", "yellow"]

Example 2: remove all mutliple items from array javascript

arr = [2, 2, 2, 1, 3, 3, 3,3, 4, 5];
arr = arr.sort().filter((item,i)=>!(arr[i] == arr[i+1] || arr[i-1]==arr[i]));
// this will remove all item which are repeating more then one
console.log(arr);
// [1, 4, 5]