The pop() Function function is used to remove the last element from the Array.
Let us say, we have a Array that contains three names, Mohan, Kriti and Salim. And we want to remove the last element i.e. Salim.
<html>
<body>
<script>
x = ["Mohan", "Kriti", "Salim"]
x.pop()
document.write("[",x,"]")
</script>
</body>
</html>
So, in the above code we have created a Array and initialised to the variable x.
x = ["Mohan", "Kriti", "Salim"]
Below is how the values are positioned in the Array,
-Function1.png)
Next, we have used the pop() function that removes the last element from the Array.
x.pop()
-Function2.png)
And we get the below output,
[Mohan,Kriti]