shift()
is ideal for your situation. shift()
removes the first element from an array and returns that element. This method changes the length of the array.
array = [1, 2, 3, 4, 5];
array.shift(); // 1
array // [2, 3, 4, 5]
More Related Contents:
- Javascript Array – Split string at numbers [closed]
- JS join arrays with replacement
- How can I group an array of objects by key?
- How to sort an array of integers correctly
- How to create an array containing 1…N
- How to loop through an array containing objects and access their properties
- How to check if a string contains text from an array of substrings in JavaScript?
- How to convert a string of numbers to an array of numbers?
- How to convert uint8 Array to base64 Encoded String?
- Why do empty JavaScript arrays evaluate to true in conditional structures?
- How to replace item in array?
- How to check whether multiple values exist within an Javascript array
- Compute intersection of two arrays in JavaScript [duplicate]
- Converting JSON object to CSV format in JavaScript
- Importing data from multiple csv files in D3
- Filtering array of objects by searching nested object properties
- Convert string array to array in javascript
- Converting an array to a function arguments list [duplicate]
- Difference between Array.length = 0 and Array =[]?
- jQuery UI autocomplete with item and id
- Javascript Set vs. Array performance
- console.log(result) prints [object Object]. How do I get result.name? [duplicate]
- How to search for a string inside an array of strings
- Populate nested object from array?
- What is the concept of Array.map?
- Javascript – Loop through array backwards with forEach
- Determining whether one array contains the contents of another array in JavaScript/CoffeeScript
- Can a JavaScript variable be used in plain HTML?
- Can forEach in JavaScript make a return? [duplicate]
- javascript – Convert array to string while preserving brackets