Hello everyone, I am new to core JavaScript and currently learning how to create an array. I have written the following code but for some reason, the pop method is not working as expected.
var players=['david','micky','Ryan','Benjamin','fransesco'];
var totalPlayers=players.length;
var lastPlayer=players.pop();
alert("The Last Player is " + lastPlayer);
alert("The total number of players are " + totalPlayers);
However, the alert for the last player is not displaying. Can someone please point out where I might be making a mistake? Thank you.