The slice() method is used to return selected elements in an array, as a new array. This method is used to select from a given start, up to a given end. However, it does not change the original array.
Its syntax is:- array.slice(start, end)
Its return is:- a new array containing the selected elements.
|start||Optional. Start position. Default is 0.|
|end||Optional. End position. Default is the last element.|