1
00:00:00,770 --> 00:00:03,350
Let's talk about the last method.

2
00:00:03,800 --> 00:00:10,400
Then we start our coding challenge and that is filter because you may need all this concept, be able

3
00:00:10,400 --> 00:00:12,710
to solve some of the coding challenges.

4
00:00:12,710 --> 00:00:14,810
So let's get rocking.

5
00:00:15,410 --> 00:00:21,410
Let me comment this once or for the meantime, let me comment out this logic here and now.

6
00:00:21,560 --> 00:00:24,710
Let me use the same data here for.

7
00:00:25,580 --> 00:00:26,690
The filter.

8
00:00:26,690 --> 00:00:30,530
So we'll come down here and let's say filter.

9
00:00:30,800 --> 00:00:36,620
The name is even also clear to us what actually is supposed to do.

10
00:00:37,170 --> 00:00:44,120
Flavor type means that we are going to have let's say that I have this box.

11
00:00:45,480 --> 00:00:46,320
Like that.

12
00:00:46,320 --> 00:00:51,300
And in this box I have let's see a lot of books or less.

13
00:00:51,300 --> 00:00:54,270
Let me see books or let me see students, for example.

14
00:00:54,270 --> 00:00:54,510
Yeah.

15
00:00:54,540 --> 00:00:57,810
Students are in this array like that.

16
00:00:57,810 --> 00:00:59,040
These are students.

17
00:00:59,520 --> 00:01:01,920
Yes, these are students here.

18
00:01:02,190 --> 00:01:02,800
Good.

19
00:01:02,850 --> 00:01:10,800
So for these students, we want to select after examination, you want to know all students who got

20
00:01:10,800 --> 00:01:12,600
above 90%.

21
00:01:12,990 --> 00:01:18,360
I'm going to put you in a different class or it's going to different in a different way.

22
00:01:18,420 --> 00:01:23,720
So let's say we got at least I mean, two of them who got above 90%.

23
00:01:23,730 --> 00:01:29,940
We see that we have filtered out those that are here into a new array.

24
00:01:30,830 --> 00:01:32,000
That's about future.

25
00:01:32,120 --> 00:01:32,770
Right.

26
00:01:32,780 --> 00:01:35,780
So if you were to create a new array.

27
00:01:36,600 --> 00:01:43,380
And it's called a new array out of this, the original array based on our criteria.

28
00:01:43,830 --> 00:01:47,970
So for this date, we have right now about edges.

29
00:01:48,120 --> 00:01:51,030
For the meantime, let's say scores.

30
00:01:52,090 --> 00:01:53,320
Scores I read.

31
00:01:54,590 --> 00:01:55,190
Good.

32
00:01:55,910 --> 00:02:01,610
So for this cause I really I think to the person go to is not make sense.

33
00:02:01,940 --> 00:02:05,260
Let's see 50 and then this is 60.

34
00:02:05,270 --> 00:02:06,020
Yes.

35
00:02:06,470 --> 00:02:07,970
This examination was tough.

36
00:02:07,970 --> 00:02:10,610
Nobody got above 70%.

37
00:02:11,270 --> 00:02:12,290
We are wicked.

38
00:02:12,620 --> 00:02:17,720
So here, let's say that find or score.

39
00:02:18,860 --> 00:02:19,850
Above.

40
00:02:21,070 --> 00:02:23,620
Let's say 20.

41
00:02:24,470 --> 00:02:28,480
About 20 years a m is about 5050.

42
00:02:28,510 --> 00:02:29,150
Yes.

43
00:02:29,170 --> 00:02:30,880
How are you going to do it?

44
00:02:31,030 --> 00:02:32,650
The same way we did for fine.

45
00:02:32,650 --> 00:02:39,910
But instead are going to use filter to filter out those who who I mean, pass our criteria here.

46
00:02:40,060 --> 00:02:41,200
So here we go.

47
00:02:41,560 --> 00:02:44,560
So the same process as we did.

48
00:02:44,560 --> 00:02:47,200
So we I would take this course array.

49
00:02:47,560 --> 00:02:49,030
Let me go up a little bit.

50
00:02:49,180 --> 00:02:50,800
Dot filter.

51
00:02:53,700 --> 00:02:58,110
Futura my function and then my callback function as that.

52
00:02:58,110 --> 00:03:04,560
And inside I have the individual record as my score and now my parentheses as that.

53
00:03:04,830 --> 00:03:08,850
So here, retain what I'm going to retain.

54
00:03:08,910 --> 00:03:16,320
Again, if you try to console that log, the score is the same thing you got as find.

55
00:03:16,620 --> 00:03:19,080
You see that we got the individual record here.

56
00:03:19,080 --> 00:03:24,240
So this call represents these values here in the callback function.

57
00:03:25,040 --> 00:03:25,820
Like that.

58
00:03:26,810 --> 00:03:35,090
So now if I get that one, I can return from this function that hey, if the score.

59
00:03:36,480 --> 00:03:39,210
Is more than 50.

60
00:03:39,480 --> 00:03:41,480
Then I won't get those.

61
00:03:41,490 --> 00:03:46,140
So as soon as this function returns through, the filter will not run again.

62
00:03:46,530 --> 00:03:52,770
So now let's assign the result to a variable called C unsigned equal to that.

63
00:03:53,340 --> 00:03:59,700
So if I console.log the answer, check the console.

64
00:03:59,850 --> 00:04:01,680
We have only 60.

65
00:04:02,550 --> 00:04:05,450
So that this one is an array in an array.

66
00:04:05,460 --> 00:04:07,740
But if I bring find here.

67
00:04:08,760 --> 00:04:14,010
We see is a single value because I read returns the fine, returns a single value.

68
00:04:14,460 --> 00:04:15,990
If I bring it back to filter.

69
00:04:17,380 --> 00:04:18,190
If pure to back.

70
00:04:18,220 --> 00:04:19,930
You see that is an array.

71
00:04:20,200 --> 00:04:28,720
So here, if I add, let's say 70 or 90 here you see that I get those values in the array because they

72
00:04:28,720 --> 00:04:30,310
are all above 50.

73
00:04:30,760 --> 00:04:33,310
I can also add 100 into it.

74
00:04:33,340 --> 00:04:43,150
Now we see that 60, 90, 100 are above 40, 50 score and that is about the future.

75
00:04:43,750 --> 00:04:48,820
So in the next video, let's start with our first coding challenge and the arrays.

