How to remove the first item from an array in JavaScript

1 Answer

0 votes
const arr = ["javascript", "php", "c++", "python"];

arr.shift();

arr.forEach(function(item, index, array) {
  document.write(item + " " + index + "<br />");
});



/*
run:
      
php 0
c++ 1
python 2
    
*/

 



answered Nov 2, 2019 by avibootz

Related questions

1 answer 252 views
1 answer 250 views
4 answers 455 views
1 answer 283 views
1 answer 276 views
1 answer 301 views
1 answer 268 views
...