How to remove the first 2 elements from an array in JavaScript

1 Answer

0 votes
const arr = ['javascript', 'typescript', 'node.js', 'c++', 'c'];

arr.splice(0, 2);

console.log(arr); 

  
  
  
  
/*
run:
  
["node.js", "c++", "c"]
  
*/

 



answered Jun 10, 2022 by avibootz

Related questions

1 answer 232 views
1 answer 194 views
1 answer 209 views
1 answer 191 views
1 answer 194 views
1 answer 179 views
...