how to print the last element of an array
var array = [1,2,3,4,5];
var last_element = array[array.length - 1];
console.log(last_element); //Expected Output: 5
how to print the last element of an array
var array = [1,2,3,4,5];
var last_element = array[array.length - 1];
console.log(last_element); //Expected Output: 5
last element array java
// Array of doubles
double[] array_doubles = {2.5, 6.2, 8.2, 4846.354, 9.6};
// First position
double firstNum = array_doubles[0]; // 2.5
// Last position
double lastNum = array_doubles[array_doubles.length - 1]; // 9.6
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us