print the last item in an array javascript code example
Example: javascript last element of an array
var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last
var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last