javascript take first element of array

JavaScript
const array = [1,2,3,4,5];
const firstElement = array.shift();

// array -> [2,3,4,5]
// firstElement -> 1arr[0]let array = ["a", "b", "c", "d", "e"];

// Both first1 and first2 have the same value.
let [first1] = array;
let first2 = array[0];
Source

Also in JavaScript: