find last num in an array js code example
Example 1: javascript get the last array element
const myArray = [1, 2, 3]
console.log(myArray.item(-1))
//=> 3
Example 2: get the last element of array javascript
if (loc_array[loc_array.length - 1] === 'index.html') {
// do something
} else {
// something else
}