当前位置:首页 >> 网络编程

JavaScript中使用Math.PI圆周率属性的方法

 这将返回一个圆到其直径的圆周的比率,大约3.14159.
语法

Math.PI

例子:

<html>
<head>
<title>JavaScript Math PI Property</title>
</head>
<body>
<script type="text/javascript">
  var property_value = Math.PI
  document.write("Property Value is : " + property_value); 
</script>
</body>
</html>

这将产生以下结果:

Property Value is : 3.141592653589793