Array push() Method

The Array push() method appends one or more elements to the end of an array. The syntax for this method is


			array.push(element1, element2, ..., elementN); 
			

where element1, element2, ... , elementN are elements to be added to array. In this example, we add another element Gentoo to the end of an existing array named os using push()


			var os = ["Debian", "Fedora", "openSUSE", "Ubuntu"];
			os.push('Gentoo');
			

and the resulting new array becomes


			["Debian", "Fedora", "openSUSE", "Ubuntu", "Gentoo"];
			

We can also add more than one element at a time to the existing array os


			os.push('Knoppix', 'Elementary OS');
			

and we get another new array


			["Debian", "Fedora", "openSUSE", "Ubuntu", "Gentoo", "Knoppix", "Elementary OS"];