Tag Archives: Javascript Shift array method

Javascript Shift array method

Shift Removes the first element from an array and returns that element. This method changes the length of the array. Syntax array.shift() Example // assumes a println function is defined var myFish = [“angel”, “clown”, “mandarin”, “surgeon”]; println(“myFish before: ” + myFish); var shifted = myFish.shift(); println(“myFish after: ” + myFish); println(“Removed this element: ” […]