- Learning JavaScript Data Structures and Algorithms
- Loiane Groner
- 86字
- 2021-08-27 18:41:15
Using the shift method
To remove an element from the beginning of the array, we can use the shift method, as follows:
numbers.shift();
If we consider that our array has the value -4 to 12 and a length of 17 after we execute the previous code, the array will contain the values -3 to 12 and have a length of 16.