remove something from the end of an array with pop

pop is the opposite of push and will remove the last item in an array, it also returns the value so you can assign it to a variable

Javascript

var my_array = [ ["cat", 1], ["dog", 2],["fish", 3] ];
var my_array_item = my_array.pop();
console.log("the removed item: "+my_array_item);
console.log("the array: "+my_array);

Other Items in javascript
Page Views

This page has been viewed 270 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹

Random Quote
All of humanity's problems stem from man's inability to sit quietly in a room alone, wrote Blaise Pascal.
Unknown