JS obtient le dernier élément du tableau
var arr = [1, 2, 3];
var last_element = arr.reverse()[0];
Borma
var arr = [1, 2, 3];
var last_element = arr.reverse()[0];
const lastItem = colors[colors.length - 1]
const arr = [5, 3, 2, 7, 8];
const last = arr.at(-1);
console.log(last);
/*
Output: 8
*/