The built in JS array type can be used as a stack by using the built in .push() and .pop() methods. For a queue, you just push to index 0. No problem there if you ask me.
Also if you want more support there are countless libraries out there that cover other data structures.... Without using strings!
The built in JS array type can be used as a stack by using the built in
.push()
and.pop()
methods. For a queue, you just push to index 0. No problem there if you ask me.Also if you want more support there are countless libraries out there that cover other data structures.... Without using strings!
But it's still an array, not a stack or a queue. You can't modify random elements in these structures.