1
00:00:00,710 --> 00:00:01,850
Welcome back.

2
00:00:01,880 --> 00:00:08,510
Let's talk about the last meeting, I think last or two, and that is slice or kill.

3
00:00:08,540 --> 00:00:13,250
So comment out and now come down here.

4
00:00:13,460 --> 00:00:18,380
We're going to be slice, slice, method.

5
00:00:21,410 --> 00:00:22,910
So what is the slice method?

6
00:00:22,940 --> 00:00:29,600
The slice method extract a certain section of a string, meaning we are going to slice it.

7
00:00:29,600 --> 00:00:33,370
I mean, cutting part of a certain string is called slicing.

8
00:00:33,380 --> 00:00:36,650
I'm going to slice it by cutting part of a string.

9
00:00:37,130 --> 00:00:38,240
It's called slice.

10
00:00:38,450 --> 00:00:44,930
Well, the initial position is always zero and the subsequent is one meaning from zero one to it's like

11
00:00:44,930 --> 00:00:50,900
in that base like that where the negative value picks from the end of the string and the slice method

12
00:00:50,900 --> 00:00:53,750
does not alter the original string.

13
00:00:54,230 --> 00:01:01,070
So let's say that one cool thing is that it enables you to select from a given starting point, but

14
00:01:01,070 --> 00:01:03,470
it also included an giving endpoint.

15
00:01:03,470 --> 00:01:09,500
And this method is that it doesn't change the entire or the original array.

16
00:01:09,740 --> 00:01:11,330
So let me show you what I'm in here.

17
00:01:11,450 --> 00:01:13,820
Let's say that I have a string.

18
00:01:15,290 --> 00:01:20,240
I have a string which is equal to where I come to.

19
00:01:22,240 --> 00:01:22,620
Oop.

20
00:01:23,320 --> 00:01:25,300
Welcome to JavaScript.

21
00:01:27,500 --> 00:01:30,500
JavaScript meets like that.

22
00:01:30,530 --> 00:01:31,040
Good.

23
00:01:31,220 --> 00:01:38,360
So I want to start slicing out, let's say, some part of the string, let's say for the work arm.

24
00:01:38,390 --> 00:01:43,460
I want to remove the w e and then I'll have l come.

25
00:01:43,610 --> 00:01:48,470
So you're going to use slice for this one or we can remove this method at the end or you can remove

26
00:01:48,470 --> 00:01:52,040
this one or slice it in any way the way you want it.

27
00:01:52,310 --> 00:01:53,680
So let's see.

28
00:01:53,690 --> 00:02:02,540
So let's assign the result coming back after slicing into a variable chorus and now my str dot slice.

29
00:02:02,930 --> 00:02:09,830
And then for the slice I want to start from zero and then end at five.

30
00:02:10,130 --> 00:02:15,320
So let's see, I want to slice out from zero up to five.

31
00:02:15,320 --> 00:02:19,430
So zero one, two, three, four, five.

32
00:02:20,150 --> 00:02:22,610
Okay, so let's console.log the.

33
00:02:23,510 --> 00:02:29,450
The response and let's see, we see that I get Waco because it started from here.

34
00:02:29,570 --> 00:02:34,130
Zero one, two, three, four, five.

35
00:02:34,750 --> 00:02:38,320
Why did we get em after slicing it.

36
00:02:38,830 --> 00:02:47,080
Take note is is that the slice does not include.

37
00:02:48,290 --> 00:02:49,550
The giving.

38
00:02:50,960 --> 00:02:54,170
So if you save five, it ends here.

39
00:02:54,650 --> 00:02:57,320
Zero one, two, three, four, five.

40
00:02:57,320 --> 00:03:00,440
It ends on the M by the last one.

41
00:03:00,440 --> 00:03:02,150
It doesn't include it.

42
00:03:02,510 --> 00:03:09,110
So if we want to include maybe five characters in to provide six, add the second argument.

43
00:03:09,200 --> 00:03:18,950
If you want nine if one nine provide ten, you add one three because it doesn't include the the ending

44
00:03:19,250 --> 00:03:20,000
point.

45
00:03:20,000 --> 00:03:24,230
So if I want to include the M and it changes 1 to 6.

46
00:03:25,380 --> 00:03:27,300
And now I have Web.com.

47
00:03:28,410 --> 00:03:29,280
That is it.

48
00:03:29,640 --> 00:03:35,400
Well, so what about if I want to start from let's say I wanna start from, let's say two.

49
00:03:36,550 --> 00:03:38,140
So we start from way to zero.

50
00:03:38,140 --> 00:03:39,820
Here is 012.

51
00:03:39,850 --> 00:03:43,570
I want to start from two here and then start slicing up to six.

52
00:03:43,750 --> 00:03:44,530
Let's see.

53
00:03:44,920 --> 00:03:46,900
Let me save it.

54
00:03:46,900 --> 00:03:55,320
And I get AL.com because I have skipped 011 to here and then now I move to error.

55
00:03:55,330 --> 00:03:58,900
And then I got this webcam that is about to slice for you.

56
00:03:59,470 --> 00:04:04,090
So in this video, let's see our coding challenge and slicing.

