Question: (Stack javascript) please need it in fast time . Complete the global method duplicateElement in the class Quiz which receives a stack and a
(Stack javascript) please need it in fast time .

Complete the global method " duplicateElement" in the class "Quiz" which receives a stack and a number and returns a new stack that contains a copy of the received stack but the elements that are equal to the received number are duplicated. Note that: 1. You are not allowed to modify or print anything, just complete the implementation of the method. 2. You have to keep the order of new stack the same as the original stack. Example: Original stack: S = [1,2,3,4,5) After calling the method with Sand 3: New stack = [1, 2, 3, 3, 4, 5]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
