javascript shift
var list = ["bar", "baz", "foo", "qux"];
list.shift()//["baz", "foo", "qux"]//The shift() method removes the first element from an array
//and returns that removed element.
//This method changes the length of the array.
const array1 = [1, 2, 3];
const firstElement = array1.shift();
console.log(array1);
// expected output: Array [2, 3]
console.log(firstElement);
// expected output: 1
let array = ["A", "B", "C"];
//Removes the first element of the array
array.shift();
//===========================
console.log(array);
//output =>
//["B", "C"]/*The shift() method removes an element from the beginning of an array,
while pop() removes an element from the end.*/
let greetings = ['whats up?', 'hello', 'see ya!'];
greetings.shift();
// now equals ['hello']
greetings.pop();
// now equals ['whats up?', 'hello']const array1 = [1, 2, 3];
const firstElement = array1.shhift();
console.log(array1);
// output: Array [2, 3];
https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/shiftconst arr = ['foo', 'bar', 'qux', 'buz'];
arr.shift(); // 'foo'
arr; // ['bar', 'qux', 'buz']