Access Last Element

ARRAY

Problem

Given a non-empty array array, return the last element of this array.

Examples

lastElement([7,4,2]) // 2 lastElement([1]) // 1
Loading...