Home >Web Front-end >JS Tutorial >Javascript implements finding the area of a circle with a given radius_javascript skills
The code is quite simple, so I won’t go into too much nonsense here. Friends, please refer to it for yourselves.
<script> var circularityArea = new Function("r","return r*r*Math.PI"); //创建一个函数对象 var rCircle = 2;//给定圆的半径 var area = circularityArea(rCircle); alert("半径为2的圆面积为:" + area); </script>
The above is the entire content of this article, I hope you all like it.