Typescript Find Lowest Value In Array Js Slice Function In R