Mega Code Archive

 
Categories / JavaScript Tutorial / Array
 

Use Array shift to remove the first element from an array

< html> <head> <title>Removing the first Element</title> <script language="javascript" type="text/javascript"> <!-- var x = new Array(1,2,3,4); var firstElement = x.shift(); alert(firstElement); alert(x.length); alert(x); //--> </script> </head> <body> <h1>Removing the first Element</h1> </body> </html>