Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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'] 
Source by alligator.io #
 
PREVIOUS NEXT
Tagged: #shift #unshift #js
ADD COMMENT
Topic
Name
6+4 =