
array.slice() – Returns a **shallow copy** of a portion of an array into a new array object.
๐ Syntax
newArray = array.slice(startIndex, endIndex);
๐งช Example
['a','b','c'].slice(1); // ['b','c']

array.slice() – Returns a **shallow copy** of a portion of an array into a new array object.
newArray = array.slice(startIndex, endIndex);
['a','b','c'].slice(1); // ['b','c']
Comments
Post a Comment