Question: Implement a Stack computer in Javascript (JSFiddle). This is a simple computer that keeps a stack, when a number is entered it goes onto the
Implement a Stack computer in Javascript (JSFiddle). This is a simple computer that keeps a stack, when a number is entered it goes onto the top of the stack. When an operation is entered, the previous 2 numbers are operated on by the operation.
For example:
2 [enter] 2
5 [enter] 5 2
* [enter] * 5 2 -> collapses to 10
would leave at 10 at the top of the stack.
The program should use a simple input box, either a text field or prompt and display the contents of the Stack.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
