How to remove the first N items from array in Node.js

1 Answer

0 votes
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
 
console.log(arr);
 
let N = 2
 
arr.splice(0, N);
 
console.log(arr);
 
   
     
     
/*
run:
     
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[3, 4, 5, 6, 7, 8, 9]
     
*/

 



answered Feb 18, 2022 by avibootz

Related questions

1 answer 132 views
1 answer 142 views
2 answers 167 views
1 answer 117 views
1 answer 109 views
1 answer 129 views
...