How to show a real time calculation in javascript?

Sample input for the above code is: ["2+4/5*5", "12-5*2", "6/2*(1+2)+4"]

Sample output is:

• Question: 2+4/5*5
• Hint: 2+0.8*5
• Hint: 2+4
• Answer: 6

• Question: 12-5*2
• Hint: 12-10
• Answer: 2

• Question: 6/2*(1+2)+4
• Hint: 6/2*3+4
• Hint: 3*3+4
• Hint: 9+4
• Answer: 13

The timings for when hints are revealed cannot be realistically shown in this text format.
You can experience it though by visiting http://jsfiddle.net/pmw57/15r6x4fk/42/

Be sure to press the jsfiddle Run button at upper-left, to run the code again.

5 Likes