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

Example Javascript Usage[]

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