show only last item from array code example
Example 1: how to get last element of array
return array[array.length - 1];
Example 2: js take last item in array
const heroes = ["Batman", "Superman", "Hulk"];
const lastHero = heroes.pop(); // Returns last elment of the Array
// lastHero = "Hulk"