DEV Community

Cover image for JavaScript Array - Push/Pop/Shift/Unshift - visual explanation
Kiru
Kiru

Posted on • Updated on • Originally published at thepracticaldev.s3.amazonaws.com

JavaScript Array - Push/Pop/Shift/Unshift - visual explanation

JavaScript array push, pop, shift and unshift with visual explanation.

Push - Add elements to the end of an array (Addition at End)
Pop - Remove an element to the end of an array (Remove at End)

Unshift - Add elements to the start of an array (Addition at Start)
Shift - Remove an element to the start of an array (Remove at Start)

alt text for accessibility

Top comments (2)

Collapse
 
savagepixie profile image
SavagePixie

I think it'd be more readable if you put the image in the body of your post, especially since I can only see two methods as it is now, so I imagine it got cropped.

Collapse
 
imkirusrinivas profile image
Kiru

Thank you, i will update my post.