add something to the end of an array with push

you can easily add to the end of a javascript array with the .push function.

Javascript

var my_array = [ ["cat", 1], ["dog", 2] ];
my_array.push(["fish", 3]);
console.log(my_array);

Demo

Other Items in javascript
Page Views

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

❤👩‍💻🕹