JavaScript - Create a copy of the stack

JavaScript - Create a copy of the stack