remove first object from array javascript code example
Example 1: remove first element of array javascript
var arr = [1, 2, 3, 4];
var theRemovedElement = arr.shift();
console.log(arr);
Example 2: remove first element of array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"]
fruits.shift()
Example 3: es6 remove first element of array
var myarray = ["item 1", "item 2", "item 3", "item 4"];
alert(myarray.shift());
alert(myarray.pop());
Example 4: how to remove first element of array in javascript
let numbers = ["I'm Not A Number!", 1, 2, 3];
numbers.shift();