JavaScript array.shift() Function

JavaScript Logo

array.shift() – Removes the **first element** from an array and returns that element.

๐Ÿ‘‰ Syntax

element = array.shift();

๐Ÿงช Example

const q=['first','second']; q.shift(); // 'first'

Comments