Shift - Unshift


shift

Removes the element from the front.
This is significantly slower than pop

alert( people.shift() );    // "steve" 
alert( people ); // "john","david"

unshift

Adds an element to the back
This is significantly slower than push

people.unshift("steve"); 
alert( people ); // "steve", "john", "david"




© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext