Array shift() method | Array shift() method in hindi

Опубликовано: 15 Февраль 2026
на канале: Code With Fun
9
1

The shift() method in JavaScript is used to remove the first element from an array. It modifies the original array by removing the first element and shifting all subsequent elements one position towards the start. The shift() method returns the removed element.

Here's a summary of the shift() method:

Syntax: array.shift()
array: The array from which the first element will be removed.
When you use the shift() method, it removes the first element from the array, effectively reducing the array's length by one. All the remaining elements are shifted one position towards the start, so the element previously at index 1 becomes the new first element at index 0.