first element is index and second element is array in javascript code example
Example: javascript take first element of array
const array = [1,2,3,4,5];
const firstElement = array.shift();
// array -> [2,3,4,5]
// firstElement -> 1
const array = [1,2,3,4,5];
const firstElement = array.shift();
// array -> [2,3,4,5]
// firstElement -> 1