Answers for "javascript array with key value find last item"

80

javascript get last element of array

var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last item in the array
Posted by: Guest on February-19-2020
28

js get last element of array

const array = ["foo", "bar", "fizz", "buzz"];
const lastElem = array.at(-1); // returns "buzz"
Posted by: Guest on March-17-2022

Code answers related to "javascript array with key value find last item"

Code answers related to "Javascript"

Browse Popular Code Answers by Language