find last element of ana array js code example
Example 1: javascript last element of array
let arr = [1,2,3]
arr[arr.length - 1] //returns last element in an array
Example 2: how to get the last element in javascript
const nums = [1, 2, 3, 4, 5, 6, 7];
const lastOne = nums[nums.lenght - 1]; // last element of array