How would you examine items below the top of a stack?
Use stack.pop() then stack.peek()
How would you find out how many items are in a stack?
let items = 0;
while (stack.peek() !== undefiend) {
stack.pop();
items++;
}
return items;How would you examine items after the front of a queue?
queue.peek();
How would you cycle through items in a queue without permanently removing them?
let thing = queue.dequeue(); queue.enqueue(thing);