How to add multiple elements at the beginning of an array in Node.js

1 Answer

0 votes
let arr = [5, 6, 7, 0, 9, 1];
 
arr.unshift(23, 89, 10); 
 
console.log(arr); 
 
 
 
   
     
     
/*
run:
     
[23, 89, 10, 5, 6, 7, 0, 9, 1]
     
*/

 



answered Aug 12, 2022 by avibootz

Related questions

...