Using Array.prototype.slice to Convert Array-like Objects to Real Arrays
The Array.prototype.slice function returns a shallow copy of a portion of an array. It receives two parameters: starting index and end index which are used as start and end points in the slice. For example the following code will slice and return a new array out of a numbers array:
Sometimes we want to use array-like objects/collections as real arrays while coding. The Array.prototype.slice function can help us to do that.