shift elements in array javascript code example
Example 1: remove first element of array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"]
fruits.shift()
Example 2: array shift javascript
const array1 = [1, 2, 3];
const firstElement = array1.shift();
console.log(array1);
console.log(firstElement);
Example 3: javascript shift
let array = ["A", "B", "C"];
array.shift();
console.log(array);
Example 4: .pop js
let monTableau = ['un', 'deux','trois', 'quatre'] ;
monTableau.pop() ;
console.log(monTableau) ;