<script>
var circularityArea = new Function("r","return r*r*Math.PI"); //创建一个函数对象
var rCircle = 2;//给定圆的半径
var area = circularityArea(rCircle);
alert("半径为2的圆面积为:" + area);
</script>
时间: 2024-10-16 08:29:58
<script>
var circularityArea = new Function("r","return r*r*Math.PI"); //创建一个函数对象
var rCircle = 2;//给定圆的半径
var area = circularityArea(rCircle);
alert("半径为2的圆面积为:" + area);
</script>