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 130 views
1 answer 115 views
1 answer 120 views
1 answer 110 views
1 answer 111 views
1 answer 102 views
...