Answers for "how to select last element in a array"

76

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
1

how to get last element of array

const lastItem = colors[colors.length - 1]
Posted by: Guest on April-19-2021
1

last element of an array

int[] array = {1,2,3};
System.out.println(array[array.length - 1]);
Posted by: Guest on July-05-2020
0

how to select last element in a array

if (loc_array[loc_array.length - 1] === 'index.html') {
   // do something
} else {
   // something else karunakar
}
Posted by: Guest on August-04-2020
0

how to select last element in a array

int[] karunakar={1,2,3};
System.out.println(karunakar[karunakar.length-1]);
Posted by: Guest on August-04-2020

Code answers related to "how to select last element in a array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language