DEV Community

Discussion on: Implementing the Stack Data Structure in Javascript

Collapse
lewiscowles1986 profile image
Lewis Cowles

I was thinking even the terms pop, push and shift, unshift would come up was all. Personally I think queue, dequeue would be better names but we can't go breaking public API's based on one persons persnickety notions ;-)

It's great you want people to get familiarised, I think that is another benefit to arrays, and certainly your examples will translate better to Java, Python or C.

On pointers, Asm / C with a layer of "my language gives me this" :-).

In CPP I'm currently re-learning for newer language features (supposed to be updating but it turns out I was writing C with classes for years). Basically everything is meant to be a reference unless you're systems-level and need the control / PITA which is manual pointers. So you might as well if you're handling C++ use references and if you need pointers write C (for learners or people not controlling space-vehicles or operating on tiny embedded packages).