javascript obtient le dernier élément du tableau
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 colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
let array = [1,2,3,4,5];
let lastElement = array.pop();
// array -> [1,2,3,4];
// lastElement = 5;
var arr = [1, 2, 3];
var last_element = arr.reverse()[0];
var last = arr[arr.length - 1]