Access First Element
ARRAY
Problem
Given a non-empty array array
, return the first element of this array.
Examples
firstElement([3, 5, 7, 1]) // 3 // The first element in the array is 3. firstElement([2, 4, 5]) // 2 // The first element in the array is 2.
Loading...