- 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
How to remove first array element in JavaScript and return it?
To remove first array element, use the JavaScript shift() method. JavaScript array shift() method removes the first element from an array and returns that element.
Example
You can try to run the following code to remove first array element and return it −
<html> <head> <title>JavaScript Array shift Method</title> </head> <body> <script> var element = [30, 45, 70, 90, 110].shift(); document.write("Removed first element is : " + element ); </script> </body> </html>
Output
Removed first element is : 30
- Related Articles
- How to remove last array element in JavaScript and return it?
- How to remove the 0th indexed element in an array and return the rest of the elements in JavaScript?
- First element and last element in a JavaScript array?
- How to remove every Nth element from an array JavaScript?
- Get the first element in an array and return using MongoDB Aggregate?
- Remove element from array referencing spreaded array in JavaScript
- How to remove array element in MongoDB?
- JavaScript Remove random item from array and then remove it from array until array is empty
- Get the first element of array in JavaScript
- How to remove element in a MongoDB array?
- Finding first unique element in sorted array in JavaScript
- Return the first duplicate number from an array in JavaScript
- Constructing an array of addition/subtractions relative to first array element in JavaScript
- How do I remove a particular element from an array in JavaScript
- Finding the first redundant element in an array - JavaScript

Advertisements