find last of array code example
Example 1: get last element of array javascript
var numbers = ["one", "two", "three"];
var lastnumber = numbers[numbers.length - 1];
console.log(lastnumber);
Example 2: javascript find last element in array
if (loc_array[loc_array.length - 1] === 'index.html') {
// do something
} else {
// something else
}