the code is saying…
filter the array and return any values that are not equal to 5?
you could do if val === 5 ( cut it from the array) and return the resulting array…
this way is faster mebbe?
Another way of stating this, is the above code is an example of using filter to keep only the array elements that are not equal to 5.
It is easier for me to think about what filter keeps instead of what it is going to remove. While iterating through the values in the array, it will keep only the array elements where the returned value is true.