JavaScript 中的 Math.PI 属性

htmljavascriptweb developmentfront end technology

Math 对象的 PI 属性表示 pi 的值(圆的周长和直径之比)。

语法

其语法如下

Math.PI

示例

<html>
<head>
   <title>JavaScript 示例</title>
</head>
<body>
   <script type="text/javascript">
      var result = Math.PI;
      document.write(result);
   </script>
</body>
</html>

输出

3.141592653589793

相关文章