javascript obtener el último elemento de la matriz
var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last item in the array
Javascript obtener el último elemento en la matriz
var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
js tomar el último elemento en la matriz
const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"
javascript toma el último elemento del array
let array = [1,2,3,4,5];
let lastElement = array.pop();
// array -> [1,2,3,4];
// lastElement = 5;