remove the first element in an array with shift

like pop but shift does the 1st element in an array

Javascript

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

Demo

Other Items in javascript
Page Views

This page has been viewed 65 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.

❤👩‍💻🕹