Dave's Brain

Browse - programming tips - javascript append to an 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
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, 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.
Advertisements: