xxxxxxxxxx
const array = [2, 3, 4];
const elementToAdd = 1;
array.unshift(elementToAdd);
console.log(array); // Output: [1, 2, 3, 4]
xxxxxxxxxx
// example:
let yourArray = [2, 3, 4];
yourArray.unshift(1); // yourArray = [1, 2, 3, 4]
// syntax:
// <array-name>.unshift(<value-to-add>);
xxxxxxxxxx
let myArray = [2, 3, 4, 5];
let newElement = 1;
myArray.unshift(newElement);
console.log(myArray); // Output: [1, 2, 3, 4, 5]
xxxxxxxxxx
var arr = [23, 45, 12, 67];
arr = [34, arr]; // RESULT : [34,23, 45, 12, 67]
console.log(arr)