The pop() method of an array removes the last element from the array and returns it.

    
    const pets = ['cat', 'dog', 'bird'];

    const petsLastElement = pets.pop();

    console.log(petsLastElement);
    // "bird"