Question: This question is for the functionality of a calculator only using java script. HTML and css were provided to me When a number or operator
This question is for the functionality of a calculator only using java script. HTML and css were provided to me
When a number or operator is clicked, it should append the number or operator to the textbox.
If C is clicked, it should clear all the content inside the textbox.
If = is clicked, it should evaluate the equation in the textbox and replace the equation with the answer.
If the equation has an issue with it (E.g.: 10++5), it should replace the content inside the textbox with Error. Following that, if a number or operator is then clicked, it should then replace Error with whatever number or operator is clicked.
Hint: The following code snippet will return true if all characters within the textbox are valid (numbers or any of the following characters .+-*/) or false if there are any invalid characters:
RegExp('^[0-9\\.\\+\\-\\*\\/]+$').test(document.calculator.equation.value)
HTML FOR PAGE:
Calculator
this is what the page looks like

Calculator 7 8 9 4. 5 6 1 2 3 0 + II C
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
