Implement a stack data structure in JavaScript that contains the following operations:
StackCreates an instance of a Stack class that doesn't contain any items. The constructor not accept any arguments.
pushPushes an item onto the top of the stack.
{*} item: The item to be pushed onto the stack.{number}: The new length of the stack.popRemove an item at the top of the stack.
{*} item: The item at the top of the stack if it is not empty, undefined otherwise.isEmptyDetermines if the stack is empty.
{boolean}: true if the stack has no items, false otherwise.peekReturns the item at the top of the stack without removing it from the stack.
{*}: The item at the top of the stack if it is not empty, undefined otherwise.lengthReturns the number of items in the stack.
{number}: The number of items in the stack.const stack = new Stack();stack.isEmpty(); // truestack.push(1);stack.push(2);stack.length(); // 2stack.push(3);stack.peek(); // 3stack.pop(); // 3stack.isEmpty(); // false