Answers for "8.3.1. Common Array Methods // shift Examples (.shift)"

0

8.3.1. Common Array Methods // shift Examples (.shift)

//The general syntax for this method is:
arrayName.shift()

//This method removes and returns the FIRST element in an array.
//No arguments are placed inside the parentheses ().

let arr = ['a', 'b', 'c', 'd', 'e'];

arr.shift();

console.log(arr);

//'a'
//['b', 'c', 'd', 'e']
Posted by: Guest on June-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language