How to remove the first N items from array in JavaScript

1 Answer

0 votes
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];

console.log(arr);

let N = 3

arr.splice(0, N);

console.log(arr);

  
    
    
/*
run:
    
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[4, 5, 6, 7, 8, 9]
    
*/

 



answered Feb 1, 2021 by avibootz
...