javascript pop first element

JavaScript
const array1 = [1, 2, 3];

const firstElement = array1.shift();

console.log(array1);
// expected output: Array [2, 3]

console.log(firstElement);
// expected output: 1var fruits = ["Banana", "Orange", "Apple", "Mango"]
fruits.shift()var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();var list = ["bar", "baz", "foo", "qux"];
list.shift()//["baz", "foo", "qux"]pop(): Remove an item from the end of an array.
push(): Add items to the end of an array.
shift(): Remove an item from the beginning of an array.
unshift(): Add items to the beginning of an array.var colors = ["red", "green", "blue"];
var red=colors.shift();
//colors is now ["green","blue"];
Source

Also in JavaScript: