JavaScript array.slice() Function

JavaScript Logo

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']

Comments