how to get get the last element of an array code example
Example: get last item in array javascript
var colors = ["black", "white", "red", "yellow"];
var yellow = colors[colors.length - 1];
var colors = ["black", "white", "red", "yellow"];
var yellow = colors[colors.length - 1];