+ 2

What is the difference between shift and unshift ?

This question is based in JavaScript but not so sure in other programs but an really eager to know more about this terms shift and unshift

27th Aug 2019, 9:58 AM
Innocent Chobesha
Innocent Chobesha - avatar
2 Answers
+ 2
Shift takes the last element and unshift the first and pops it
27th Aug 2019, 10:24 AM
Nico Ruder
Nico Ruder - avatar
+ 1
Thanks Nico it really helps tho
27th Aug 2019, 11:48 AM
Innocent Chobesha
Innocent Chobesha - avatar