← previousnext →
Problem
Return a length-2 array containing the first and last elements of arr.
Examples
endPair([10, 20, 30, 40]) -> [10, 40]endPair([7]) -> [7, 7]
Return a length-2 array containing the first and last elements of arr.
endPair([10, 20, 30, 40]) -> [10, 40]endPair([7]) -> [7, 7]