這將返回一個圓到其直徑的圓周的比率,大約3.14159.
語法
1 Math.PI例子:
1 2 3 4 5 6 7 8 9 10 11 <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>這將產生以下結果:
1 Property Value is : 3.141592653589793