DEV Community

loading...

Discussion on: Know your JavaScript data structures

Collapse
sefrem profile image
sefrem

Wow, what a great article. I've been lacking this knowledge, i knew how these methods work but haven't really implemented them. Thank you so much.

As it's been pointed out, in the pop() method of Stack we should get the index by simply subtracting 1 - [this._length-1]. Otherwise it just decrements our initial length and that's not what we need.

Also, in dequeqe of Queue i believe the return statement is missing.

Thanks again for such a great article.