how to delete first item in array javascript code example
Example 1: javascript remove first element from array
var arr = [1, 2, 3, 4];
var theRemovedElement = arr.shift();
console.log(arr);
Example 2: remove first element from array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
Example 3: javascript remove first element from array
let flowers = ["Rose", "Lily", "Tulip", "Orchid"];
let removedFlowers = flowers.shift();
console.log(flowers);
console.log(removedFlowers);
Example 4: remove first element of array javascript
var items = ["A", "B", "C", "D"]
fruits.shift()