Shift method in array


Overview

shift method is used to remove the element from the beginning of the array

Code


													
//Name of the file : array-shift.js
arr = ['b','a','e','i','o','u'];
console.log(arr);
arr.shift();
console.log(arr);	
													
												

Run

  • Now run the snippet using the following command :
    													
    >node array-shift.js
    [ 'b', 'a', 'e', 'i', 'o', 'u' ]
    [ 'a', 'e', 'i', 'o', 'u' ]