+ 1
Is the slice method (string methods) in javascript follow the indexing rule in counting the strings word.
Here is my code var word = "ASDF GHJK L ASDF ASDF GHJK L ASDF ASDF GHJK L ASDF" console.log(word.slice(0,3));
3 Respostas
+ 3
Yes, the "slice" method return new string which represents the part in the string between the start index and the end index (excluding end). In your example it is => "ASD" (without the character in index 3, because it's exclusive). You can read more about "slice" method here: https://www.w3schools.com/jsref/jsref_slice_string.asp
+ 1
Thanks for some info at the time, i was soo confused that day because of not reading clearly the notes on the books, here is what i did not read.
The slice method takes 2 parameters: the start position, and the end position (end not included).
I didn't read the last text inside the pair of parentheses ,
BTW now its all clear thank you, @TheWhiteCat .
+ 1
Rocket Raccoon, you are welcome 😉