Closed raduflp closed 6 years ago
"Another fundamental array method is slice, which takes start and end indices and returns an array that has only the elements between them. The start index is inclusive, the end index exclusive."
Actually, that part is right before the example, but I get your point.
it's clearly stated before the example: "The start index is inclusive, the end index exclusive." .slice(2) the index 2 is included..
@guifrrs @kapreski i was just trying to think from the perspective of a newcomer to JS. When presenting a different scenario with only one argument one might not make a connection with the preceding inclusiveness note. So I think it would be reasonable to paraphrase in order to eliminate any confusion.
this would suggest that
[0, 1, 2, 3, 4].slice(2)
should produce[3, 4]
which is incorrect.