FANDOM


Programmer's Wiki
This page has been moved to the Programmer's Wiki.
Please do not make any changes or additions to this page.

Any modifications, if still appropriate, should be made on Array unshift at the Programmer's Wiki.

function array_unshift(arr) {
	for (var i = arguments.length - 1; i > 0; i--) {
		arr.unshift(arguments[i]);
	}
	return arr.length
}

Example Javascript UsageEdit

arr1 = new Array("dog", "cat", "mouse");
total = array_unshift(arr1, "gopher", "shrew");
alert(total); /* Returns: 5 */
alert(arr1); /* Returns: gopher,shrew,dog,cat,mouse */