how to remove the first element in array in js O(1) code example
Example 1: javascript remove first item from array
var colors = ["red", "green", "blue"];
var red=colors.shift();
//colors is now ["green","blue"];
Example 2: remove first element of array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"]
fruits.shift()