Welcome back.
Let's talk about the last meeting, I think last or two, and that is slice or kill.
So comment out and now come down here.
We're going to be slice, slice, method.
So what is the slice method?
The slice method extract a certain section of a string, meaning we are going to slice it.
I mean, cutting part of a certain string is called slicing.
I'm going to slice it by cutting part of a string.
It's called slice.
Well, the initial position is always zero and the subsequent is one meaning from zero one to it's like
in that base like that where the negative value picks from the end of the string and the slice method
does not alter the original string.
So let's say that one cool thing is that it enables you to select from a given starting point, but
it also included an giving endpoint.
And this method is that it doesn't change the entire or the original array.
So let me show you what I'm in here.
Let's say that I have a string.
I have a string which is equal to where I come to.
Oop.
Welcome to JavaScript.
JavaScript meets like that.
Good.
So I want to start slicing out, let's say, some part of the string, let's say for the work arm.
I want to remove the w e and then I'll have l come.
So you're going to use slice for this one or we can remove this method at the end or you can remove
this one or slice it in any way the way you want it.
So let's see.
So let's assign the result coming back after slicing into a variable chorus and now my str dot slice.
And then for the slice I want to start from zero and then end at five.
So let's see, I want to slice out from zero up to five.
So zero one, two, three, four, five.
Okay, so let's console.log the.
The response and let's see, we see that I get Waco because it started from here.
Zero one, two, three, four, five.
Why did we get em after slicing it.
Take note is is that the slice does not include.
The giving.
So if you save five, it ends here.
Zero one, two, three, four, five.
It ends on the M by the last one.
It doesn't include it.
So if we want to include maybe five characters in to provide six, add the second argument.
If you want nine if one nine provide ten, you add one three because it doesn't include the the ending
point.
So if I want to include the M and it changes 1 to 6.
And now I have Web.com.
That is it.
Well, so what about if I want to start from let's say I wanna start from, let's say two.
So we start from way to zero.
Here is 012.
I want to start from two here and then start slicing up to six.
Let's see.
Let me save it.
And I get AL.com because I have skipped 011 to here and then now I move to error.
And then I got this webcam that is about to slice for you.
So in this video, let's see our coding challenge and slicing.