Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140220

What's wrong with this code for a beginner math javascript problem? [on hold]

$
0
0

Having trouble getting the code right for the following problem:

Write the function squareArea ( or square_area ) that finds the area of the red square when you have the length of the circular arc A.

(the arc is 1/4 of the total circumference)

Use π = Math.PI.

Round to two decimals.

Here's the code I have done:

function squareArea(A){
  var radius = ((2 * A) / (Math.PI)),
  var squareArea = ((radius * radius).toFixed(2)),
  return squareArea;
}

Thanks in advance!


Viewing all articles
Browse latest Browse all 140220


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>