1
00:00:00,590 --> 00:00:08,680
Let's see how I'm going to solve this challenge since that create a function to reverse an array.

2
00:00:08,690 --> 00:00:18,440
So my function name let me use function expression the sum around function and then let's say the reversed.

3
00:00:19,860 --> 00:00:27,960
Reversed array and then equal to normal function parentheses and my care braces.

4
00:00:28,260 --> 00:00:28,860
Good.

5
00:00:28,860 --> 00:00:33,670
So it says that it should take in an array as an argument for parsing here.

6
00:00:33,690 --> 00:00:37,470
So I need to return from this function.

7
00:00:37,590 --> 00:00:40,020
What I'm getting from here as return.

8
00:00:40,020 --> 00:00:49,740
Then I would take the array and then dot reverse the method on the array, array reverse.

9
00:00:49,740 --> 00:00:52,710
And then I that and that is it.

10
00:00:52,710 --> 00:00:53,520
I'm done.

11
00:00:53,880 --> 00:01:00,360
So here, let's say by calling this function, let me comment this one out.

12
00:01:01,930 --> 00:01:04,160
So let me call the function down here.

13
00:01:04,180 --> 00:01:07,000
It says that when I call it, I should pass in what?

14
00:01:07,030 --> 00:01:08,020
The array.

15
00:01:08,260 --> 00:01:09,460
I want to reverse it.

16
00:01:09,580 --> 00:01:13,930
So I can declare a variable up here or.

17
00:01:14,440 --> 00:01:15,070
Okay.

18
00:01:16,000 --> 00:01:16,440
It's okay.

19
00:01:16,450 --> 00:01:19,200
So let's assign the results into this.

20
00:01:19,210 --> 00:01:24,360
So let's say my reverse array function then remember it should pass inward.

21
00:01:24,400 --> 00:01:27,040
If you pass in the array, I want to reverse.

22
00:01:27,040 --> 00:01:27,370
Right.

23
00:01:27,370 --> 00:01:30,270
So I can pass in in line here let's say.

24
00:01:30,280 --> 00:01:32,770
And two seven.

25
00:01:33,700 --> 00:01:34,630
Like that.

26
00:01:34,990 --> 00:01:40,750
I clearly want to address what I see clearly as one, two, three, four, five, six.

27
00:01:41,170 --> 00:01:44,490
Or we can declare everybody here, for example, cost.

28
00:01:44,500 --> 00:01:47,980
Let's see, array data is equal to this.

29
00:01:48,130 --> 00:01:52,450
Then I would say one, two, three, four, five, six, seven.

30
00:01:52,720 --> 00:01:56,260
So this data might be from external API.

31
00:01:56,380 --> 00:01:58,990
For the meantime, let's do the hard coding.

32
00:01:59,470 --> 00:01:59,770
Okay.

33
00:01:59,830 --> 00:02:03,670
So now the same thing as before so I can pass in my array here.

34
00:02:03,910 --> 00:02:05,950
This one looks a little bit cleaner like that.

35
00:02:05,950 --> 00:02:11,410
So if I console.log the response let's see.

36
00:02:11,890 --> 00:02:15,730
Check the console and now let's see.

37
00:02:16,390 --> 00:02:18,280
You see that I have reverse it.

38
00:02:18,910 --> 00:02:19,690
You see that?

39
00:02:20,050 --> 00:02:23,830
Originally we have one, two, three, four, five, six, seven.

40
00:02:23,830 --> 00:02:24,840
But now I have reverse.

41
00:02:24,880 --> 00:02:27,670
Seven, six, five, four, three, two, one.

42
00:02:27,880 --> 00:02:29,260
That's about reverse.

43
00:02:29,680 --> 00:02:34,090
The next video, let's have a look at our fourth coding challenge.

