how to get last value of array code example
Example 1: find last element in array javascript
const numArray = [1,2,3,4,5];
const lastNumber = numArray.reverse()[0];
Example 2: get last element of array javascript
if (loc_array[loc_array.length - 1] === 'index.html') {
// do something
} else {
// something else
}
Example 3: last element of array javascript
last element of array