//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
//The shift() method removes the first array element and "shifts" all other elements to a lower index.
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
// The shift() method returns the value that was "shifted out": >> Banana
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
var arr = ["f", "o", "o", "b", "a", "r"];
arr.shift();
console.log(arr); // ["o", "o", "b", "a", "r"]
let array = ["A", "B", "C"];
//Removes the first element of the array
array.shift();
//===========================
console.log(array);
//output =>
//["B", "C"]
//Array.shift() removes the first array element and returns it value
//example 1
const array1 = [1, 2, 3];
const firstElement = array1.shift();
console.log(array1);
// expected output: Array [2, 3]
console.log(firstElement);
// expected output: 1
//example 2
var arr = ["f", "o", "o", "b", "a", "r"];
arr.shift();
console.log(arr); // ["o", "o", "b", "a", "r"]
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();