JavaScript Basics
JavaScript Objects
JavaScript Advanced
JS Useful References
JS Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Javascript Array shift() Method
Description:
Javascript array shift() method removes the first element from an array and returns that element.
Syntax:
Here is the detail of parameters:
Return Value:
Returns the removed single value of the array.
Example:
<html>
<head>
<title>JavaScript Array shift Method</title>
</head>
<body>
<script type="text/javascript">
var element = [105, 1, 2, 3].shift();
document.write("Removed element is : " + element );
</script>
</body>
</html>
|
This will produce following result:
To understand it in better way you can Try it yourself.
|
|
|