let subArray = array.slice(startIndex, endIndex) // endIndex is optional, if ommited it will go to the end of the array.