How to remove all items before specific index in TypeScript

1 Answer

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

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

 



answered Jul 7, 2022 by avibootz

Related questions

2 answers 146 views
1 answer 117 views
1 answer 109 views
2 answers 166 views
2 answers 154 views
...