filter() method is a bit hard to understand for me at first. So I will share my thought to you.
Theby MDN web docs
filter()method creates a new array with all elements that pass the test implemented by the provided function.
So it would create a new array by running through all the old array with a function that returns a boolean. If true, put it into the new array.
Let’s say you have an array [3,2,2,4,8,8,8,6,9] called items. So when we want to get the values bigger than 8 or less than 8 and put them into a new array, we can use filter() method. As the screenshot, we can simply put our condition to return and there is it!