Array (array) object-> shift () method

1. Definition and usage

  The shift () method is used to delete the first element of the array from it and return the value of the first element.

  grammar:

    array.shift()

  Note:  This method changes the length of the array!

  Examples:

var arr = [1,2,3,4,5];
console.log(arr.shift());
console.log(arr);

  Output:

 

Guess you like

Origin www.cnblogs.com/abner-pan/p/12683157.html