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 165 views
1 answer 167 views
1 answer 180 views
4 answers 274 views
1 answer 176 views
1 answer 188 views
...