How to remove the first item from array in JavaScript

1 Answer

0 votes
const arr = ["javascript", "php", "c++", "python"];
 
arr.shift();
 
arr.forEach(function(item, index, array) {
   console.log(item + " " + index);
});
 
 
console.log(arr);



 
/*
run:
       
"php 0"
"c++ 1"
"python 2"
["php", "c++", "python"]
     
*/

 



answered Jun 11, 2021 by avibootz

Related questions

1 answer 249 views
1 answer 253 views
1 answer 268 views
4 answers 456 views
1 answer 283 views
1 answer 276 views
...