- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write the importance of shift() method in javascript array?
Shift()
This method is used to remove the element from an array.Moreover it is different from pop() because shift() method removes the element at the starting of the array.
Example
<html> <body> <p id="shift"></p> <script> var a = [1,2,3,4,5]; var b = ["apple","mango","banana","guava","strawberry"] a.shift(); b.shift(); document.write(a); document.getElementById("shift").innerHTML = b; </script> </body> </html>
Output
mango,banana,guava,strawberry 2,3,4,5
- Related Articles
- Array shift() in JavaScript
- JavaScript Array shift()
- What is the importance of _isEqual() method in JavaScript?
- What is the importance of _without() method in JavaScript?
- What is the importance of _.union() method in JavaScript?
- What is the importance of str.padStart() method in JavaScript?
- What is the importance of Math.trunc() method in JavaScript?
- Shift certain array elements to front of array - JavaScript
- What is importance of startsWith() method in JavaScript?
- Explain the importance of Array.filter() method in JavaScript with example?
- Write the importance of seeds in plants?
- Write the usage of split() method in javascript?
- Write the use of Array.reduceRight() method in JavaScript?
- Shift last given number of elements to front of array JavaScript
- Remove number from array and shift the remaining ones JavaScript

Advertisements