“JS Tome el último artículo en la matriz” Código de respuesta

JavaScript obtenga el último elemento de matriz

var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last item in the array
Friendly Hawk

JS Tome el último artículo en la matriz

const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"
Strange Starling

Respuestas similares a “JS Tome el último artículo en la matriz”

Preguntas similares a “JS Tome el último artículo en la matriz”

Más respuestas relacionadas con “JS Tome el último artículo en la matriz” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código