
Learning Stacks In JavaScript
26 January, 2022
2
2
0
Contributors
What is a stack?
Push, which adds an element to the collection
Pop, which removes the most recently added element
Peek, which looks into the stack to see the most recently added element

Pringles into tube

First crisp from the top

Random from a bag

One at a time

Cannot take from the middle
Implementing a stack using JavaScript
push(element), to push an element to the top of the stack
pop(), removes the top element and returns it
peek(), looks into the stack to see the most recently added element
Functional programming code example
Testing with Jest
Thank you!
javascript
learning
data structures