How to add multiple items at the beginning of an array in JavaScript

1 Answer

0 votes
const arr = [1,2,3,4];

arr.unshift(77,88);

console.log(arr); 
     
     
     
     
/*
run:
     
[77, 88, 1, 2, 3, 4]
     
*/

 



answered May 24, 2021 by avibootz

Related questions

...