Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   
   HTML   
   CSS   
   JAVA SCRIPT   
   JQUERY   




pop() - FUNCTION


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.


Example :



<html>
<body>  
<script>

	x = ["Mohan", "Kriti", "Salim"]
	x.pop()
	document.write("[",x,"]") 
    
</script>      
</body>
</html>


Output :



  [Mohan,Kriti]

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,

java_Collections

Next, we have used the pop() function that removes the last element from the Array.


x.pop()
java_Collections


And we get the below output,


[Mohan,Kriti]