Answers for "js push shift unshift shift"

3

shift and unshift js

let cats = ['Bob', 'Willy', 'Mini'];

cats.shift(); // ['Willy', 'Mini']

let cats = ['Bob']; 

cats.unshift('Willy'); // ['Willy', 'Bob']

cats.unshift('Puff', 'George'); // ['Puff', 'George', 'Willy', 'Bob']
Posted by: Guest on May-12-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language