how to make a string array return the last value code example
Example 1: get last element in array in js
var array = ['red','green','yellow']
console.log(array[array.length-1])
Example 2: get last element in array in js
if (loc_array[loc_array.length - 1] === 'index.html') {
// do something
} else {
// something else
}