Extract the last element of an Array
Given an array, return the last element.
Sample Code:
function lastEle(arr) {
// Enter your logic here...
}
Examples:
Input: [1,2,3]
Output: 3
Explanation: The element 3 has the highest index value.
Input: [1]
Output: 1
Explanation: The element 1 has the highest index value.