Learning about data structures in details. Checked few js tutorials online and they seemed to use array for everything.
Like this:
class Stack {
// Array is used to implement stack
constructor()
{
this.items = [];
}
// Functions to be implemented
// push(item)
// pop()
// peek()
// isEmpty()
// printStack()
}
Array::pop()andArray::shift()let you handle an array as stack or queue.push()and.pop()methods. A queue - use a regular array and use the.push()and.shift()methods. Almost everyone simply use the arrays directly instead of wrapping them in an extra object layer