how to select elements from to an index in array in javascript without slice code example Example: array.slice in typescript arr.slice([start[, end]])