How to remove item from the end of an array in JavaScript

1 Answer

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

arr.pop();

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



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

 



answered Nov 2, 2019 by avibootz

Related questions

1 answer 186 views
1 answer 185 views
4 answers 288 views
1 answer 187 views
1 answer 172 views
1 answer 211 views
1 answer 195 views
...