How to remove all items before specific index in JavaScript

1 Answer

0 votes
const arr = ['javascript', 'php', 'python', 'c', 'c#', 'c++', 'go', 'css'];
   
const index = 3;
  
arr.splice(0, index);
   
console.log(arr); 
   
   
   
   
/*
run:

["c", "c#", "c++", "go", "css"]
   
*/

 



answered Jul 7, 2022 by avibootz

Related questions

1 answer 128 views
1 answer 136 views
2 answers 160 views
2 answers 176 views
2 answers 155 views
...