1var colors = ["red","blue","green"];
2var green = colors[colors.length - 1];//get last item in the array
1var colors = ["red","blue","green"];
2var green = colors[colors.length - 1];//get last
1if (loc_array[loc_array.length - 1] === 'index.html') {
2 // do something
3} else {
4 // something else
5}
6
7
1if (loc_array[loc_array.length - 1] === 'index.html') {
2 // do something
3} else {
4 // something else
5}