how to get last element in an 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 get last element in array
//im here because the ad
Example 3: get the last element of array javascript
if (loc_array[loc_array.length - 1] === 'index.html') {
// do something
} else {
// something else
}