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:

Lab 6 - Javascript 2

Calculator


this is what the page looks like

This question is for the functionality of a calculator only using java

Calculator 7 8 9 4. 5 6 1 2 3 0 + II C

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!