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 191 views
1 answer 189 views
4 answers 296 views
1 answer 196 views
1 answer 178 views
1 answer 216 views
1 answer 199 views
...