Complete the code to push an element onto the stack.
stack.[1](5);
The push method adds an element to the top of the stack, following the LIFO principle.
Complete the code to remove the top element from the stack.
const top = stack.[1]();The pop method removes and returns the top element of the stack, following LIFO.
Complete the code to check the top element without removing it.
const top = stack[stack.[1] - 1];
To check the top element without removing it, access stack[stack.length - 1].
Fill both blanks to create a stack and add an element to it.
const stack = new [1](); stack.[2](10);
We create a stack using an Array and add an element using push.
Fill all three blanks to remove the top element and check the stack size.
const removed = stack.[1](); const size = stack.[2]; console.log('Removed:', removed, 'Size:', [3]);
pop() removes the top element, length gives the current size of the stack.
