Dave's Brain

Browse - Programming Tips - How do I append to the end of a javaScript array?

Date: 2010nov11
Language: javaScript
Level: beginner

Q.  How do I append to the end of a javaScript array?

A.  Use push() like this:

var a = new Array(); // Create an array a.push('apple'); // append a.push('pear'); // append

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.