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]
Compile and test (Ctrl+Enter)