Let's talk about the last method.
Then we start our coding challenge and that is filter because you may need all this concept, be able
to solve some of the coding challenges.
So let's get rocking.
Let me comment this once or for the meantime, let me comment out this logic here and now.
Let me use the same data here for.
The filter.
So we'll come down here and let's say filter.
The name is even also clear to us what actually is supposed to do.
Flavor type means that we are going to have let's say that I have this box.
Like that.
And in this box I have let's see a lot of books or less.
Let me see books or let me see students, for example.
Yeah.
Students are in this array like that.
These are students.
Yes, these are students here.
Good.
So for these students, we want to select after examination, you want to know all students who got
above 90%.
I'm going to put you in a different class or it's going to different in a different way.
So let's say we got at least I mean, two of them who got above 90%.
We see that we have filtered out those that are here into a new array.
That's about future.
Right.
So if you were to create a new array.
And it's called a new array out of this, the original array based on our criteria.
So for this date, we have right now about edges.
For the meantime, let's say scores.
Scores I read.
Good.
So for this cause I really I think to the person go to is not make sense.
Let's see 50 and then this is 60.
Yes.
This examination was tough.
Nobody got above 70%.
We are wicked.
So here, let's say that find or score.
Above.
Let's say 20.
About 20 years a m is about 5050.
Yes.
How are you going to do it?
The same way we did for fine.
But instead are going to use filter to filter out those who who I mean, pass our criteria here.
So here we go.
So the same process as we did.
So we I would take this course array.
Let me go up a little bit.
Dot filter.
Futura my function and then my callback function as that.
And inside I have the individual record as my score and now my parentheses as that.
So here, retain what I'm going to retain.
Again, if you try to console that log, the score is the same thing you got as find.
You see that we got the individual record here.
So this call represents these values here in the callback function.
Like that.
So now if I get that one, I can return from this function that hey, if the score.
Is more than 50.
Then I won't get those.
So as soon as this function returns through, the filter will not run again.
So now let's assign the result to a variable called C unsigned equal to that.
So if I console.log the answer, check the console.
We have only 60.
So that this one is an array in an array.
But if I bring find here.
We see is a single value because I read returns the fine, returns a single value.
If I bring it back to filter.
If pure to back.
You see that is an array.
So here, if I add, let's say 70 or 90 here you see that I get those values in the array because they
are all above 50.
I can also add 100 into it.
Now we see that 60, 90, 100 are above 40, 50 score and that is about the future.
So in the next video, let's start with our first coding challenge and the arrays.