DEV Community


Discussion on: Stack Data Structure in Javascript

math3v profile image
Matej Minárik

Great article! I believe you cheated here a little bit though. The lower level implementation would need to remember the current head (index in the array) and accordingly update the head on push/pop actions. The whole point of implementing a Stack is to learn programming, so it should be done on the lowest level possible. Cheers!

Forem Open with the Forem app