Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create one complete JavaScript code program that performs each task below. Include comments to explain your code. Ask the user for their first name and
Create one complete JavaScript code program that performs each task below. Include comments to explain your code.
Ask the user for their first name and store it in the variable Fname. After the user types in their name, display a welcome message that contains the name they entered.
Create the constant piValue to store the value of Pi to significant digits
Ask the user to input their favorite number and store the value in a variable myFavNum
Calculate the area of a circle using the users favorite number as the radius r
Store the result in a new variable myArea.
The formula to find the area of a circle is A pi r
Use the value of Pi stored in the constant myPi.
Display the contents of each variable to the webpage in a message with each variable and text describing the variable. You can use any message you would like, but it must include each variable with a description. For example, if the user entered Sam and the message could be:
Hello Sam, you entered as your favorite number. If that was the radius of a circle, the circles area would be
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started