“Alcance a última matriz JS” Respostas de código

JS Tome o último item na matriz

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

Alcance a última matriz JS

if (locArray.at(-1) === 'index.html') {
   // do something
} else {
   // something else
}
Uninterested Unicorn

JS Array Last Element

array.slice(-1)[0]
foloinfo

Respostas semelhantes a “Alcance a última matriz JS”

Perguntas semelhantes a “Alcance a última matriz JS”

Mais respostas relacionadas para “Alcance a última matriz JS” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código