Implement a Stack in Javascript
Implement a Stack in Javascript (you will turn in a link to your program in JSFiddle). Do not use an array as the stack or in the implementation of the stack.
Build a Stack Computer from your 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 and the result is pushed onto the top of the stack. This is how an RPN calculator.
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.
|
This is what should show on right side.
If I enter say 2 it should pop to screen under this.
If I enter 5 should pop on top of 1
5
2
Then if I enter *, should multiply without showing the * and collapse the 2 and 5 to 10
So all that shows is the 10
10 years ago
Purchase the answer to view it

- ok_82.docx