JavaScript mendapatkan elemen array terakhir
var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last item in the array
Friendly Hawk
var colors = ["red","blue","green"];
var green = colors[colors.length - 1];//get last item in the array
var array =[1,2,3,4];
var last= array[array.length-1];
var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
var name = ["jon","tem","kevin", "ramos"];
var lastNameInArray = name[name.length - 1];// >> ramos
const nums = [1, 2, 3, 4, 5, 6, 7];
const lastOne = nums[nums.lenght - 1]; // last element of array