175
rated 0 times
[
176]
[
1]
/ answers: 1 / hits: 18958
/ 7 Years ago, sat, september 23, 2017, 12:00:00
So I created a .js file to calculate the area of a circle and calculateArea() needs to calculate it.
The only thing that it does is the prompt(). What am I doing wrong?
function calculateArea(myRadius){
var area = (myRadius * myRadius * Math.PI);
return area;
function MyArea(){
calculateArea(myRadius);
alert(A circle with a + myRadius +
centimeter radius has an area of + area +
centimeters. <br> + myRadius +
represents the number entered by the user <br> + area +
represents circle area based on the user input.);
}
}
var myRadius = parseFloat(prompt(Enter the radius of your circle in cm:,0));
calculateArea(myRadius);
More From » area