Question: How to get functions on a Javascript calculator to display the answer or error message in the text box. In my code I am supposed

How to get functions on a Javascript calculator to display the answer or error message in the text box.

In my code I am supposed to get the squared (x^2), halve (1/2 whatever number is entered and then divided by 2), and area of circle (area) buttons functioning while also getting the answer of any calculation or error message (display if the formula entered cannot be converted) to display in the text box of the calculator and then once another button is clicked (for example, 4, it would clear everything out in that textbox and only display the number 4, thus allowing another formula to be entered).

So far I am able to get the buttons to do the proper functions, I just need help coding it so that once the equal button is clicked, it will display the answer or error message in the text box and then clear out the text once the user clicks another button and display the number the user entered to start a new formula.

below is my code:

calculator.html -

Calculator

JS Calculator

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!