Answers for "call last item of an array js"

1

javascript get last element of array

const lastItem = colors[colors.length - 1]
Posted by: Guest on June-19-2020
0

javascript get last element of array

let arry = [2, 4, 6, 8, 10, 12, 14, 16];
let lastElement = arry[arry.length - 1];

console.log(lastElement);

//Output: 16
Posted by: Guest on September-29-2021

Code answers related to "call last item of an array js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language