How to remove all items before specific index in Node.js

1 Answer

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

[ 'c++', 'go', 'css', 'java', 'python' ]
   
*/

 



answered Jul 7, 2022 by avibootz

Related questions

2 answers 166 views
1 answer 128 views
1 answer 109 views
1 answer 113 views
1 answer 132 views
1 answer 128 views
...