STACK IN JAVASCRIPT
STACK IN JAVASCRIPT Implement Stack using array what is stack ? Stack is a linear data structure it follows LIFO(Last In First Out) or FILO(First In Last Out) principle.⬇️ PUSH( ) METHOD push method is used to push an element into end of the Stack . If you add an element they pushed/added in top of the stack.⬇️ POP( ) METHOD The element is popped from the top of the stack and they displayed from your screen.⬇️ UNSHIFT( ) METHOD unshift() method is used to add one or more elements to the beginning of the given array …….⬇️ SHIFT( ) METHOD The shift() method removes the first element from an array and returns that removed element ……⬇️ isEmpty() Return true if the stack is empty………⬇️ peek(); peek method shows top most element in stack………⬇️ size() It returns the length of the current stack…….…⬇️ clear() It r emoves all the items from the Stack…….. …⬇️ RECAP EXERCISE TIME:- Do it yourself…if you get the output comment below class Stack { constru...