javascript obține ultimul element de matrice
var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last item in the array
Javascript obține ultimul element în matrice
var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
js ia ultimul element în matrice
const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"
javascript ia ultimul element de matrice
let array = [1,2,3,4,5];
let lastElement = array.pop();
// array -> [1,2,3,4];
// lastElement = 5;