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




shift() - FUNCTION


shift() Function is used to remove first array element and shifts other elements to the left.


Let us say, we have a Array that contains four names, Mohan, Kriti, Philip and Salim. And we want to remove the first name Mohan from the Array.


Example :



<html>
<body>  
<script>

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


Output :



  Kriti,Philip,Salim

So, all we have done is, used the shift() method to delete the name Mohan from the beginning of the Array.


x.shift()

And what happens is Mohan gets removed from index 0 pushing all other elements to the left.