- [Woman] Next up is a filter operator,
so let's go ahead and import it.
Now we're going to chain this one in after the map,
and take only the values above 20.
And let's check the browser.
There we go, we only got the values above 20.
Perfect.
By the way, if you're wondering whether
it matters which order these are in, it sure does.
Let's see what will happen if we move
that filter operator tight above the map.
Save it, check the console log again.
What happened?
Nothing happened.
Why?
Because none of the original numbers were greater than 20.
Remember, when we started out with the interval,
we had zero, one, two, three, and four.
So when we take five, we get zero through four,
none of those are greater than 20.
We don't map until after the filter, so we get nothing.
What if we chose that greater than 20
to give us only even numbers?
We can use the Modulo operator for that.
Now our filter will say, only give us even numbers.
After we get the even numbers,
we're going to multiply them by 10
and then console log them.
Let's see what that does.
Sure enough, it skipped over the one and the three
because they weren't even numbers,
and the map happened after the filter.
Now if we keep the even numbers
and move the filter back below the map,
they're all even numbers after they're multiplied by 10.
So our output should be zero, 10, 20, 30, et cetera.
There you go, that's the filter operator.