Answers for "from first index to last js"

34

javascript last index

var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
Posted by: Guest on July-25-2019
0

es6 get first and last element of array

let {0 : a ,length : l, [l - 1] : b} = [1,2,3,4,5,6,7,8,9,0];
console.log(a, b)
Posted by: Guest on May-05-2021

Code answers related to "from first index to last js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language