stack using arrays

How to implement Stack data structure in JavaScript?

We have already seen about Array Data Structure. Stack data structure is implemented using arrays. With push(), pop(), shift(), unshift() we create stack . For creation of stack we always prefer push() and pop(). Now let us implement stack data structure. Methods to implement Stack Data Structure : Program to implement Stack : Output: