![]() ![]() If both start and end indexes are specified, the slice() method creates a sequence of elements that begins from the start index up till the end index – 1. In other words, the returned array contains all elements from the starting to ending of the array. If only one parameter (index value) is specified, the slice() method creates a sequence of elements that begins from index and ends on the last array element. A new array that contains the sliced out or extracted elements. The slice() method returns a shallow copy of elements from the original array. The slice() method of Array object comes into two flavors that are as: array.slice(index) It does not modify the original array on which it is called. The slice() method works on the copy of an array. Using slice() method, we can copy a portion of an array and assign it to a new variable name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |