Tag Archives: Javascript unshift array method

Javascript unshift array method

unshift Adds one or more elements to the beginning of an array and returns the new length of the array. Syntax arrayName.unshift(element1, …, elementN) Example // assumes a println function exists myFish = [“angel”, “clown”]; println(“myFish before: ” + myFish); unshifted = myFish.unshift(“drum”, “lion”); println(“myFish after: ” + myFish); println(“New length: ” + unshifted); Output […]