Math.PI
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
Math.PI ì ì ë°ì´í° ìì±ì ìì ëë ì ì§ë¦ì ë¹ì¨, ì½ 3.14159ì ê°ì ê°ì§ëë¤.
ìëí´ ë³´ê¸°
function calculateCircumference(radius) {
return 2 * Math.PI * radius;
}
console.log(Math.PI);
// Expected output: 3.141592653589793
console.log(calculateCircumference(10));
// Expected output: 62.83185307179586
ê°
Property attributes of Math.PI | |
|---|---|
| ì°ê¸° ê°ë¥ | ë¶ê°ë¥ |
| ì´ê±° ê°ë¥ | ë¶ê°ë¥ |
| ì¤ì ê°ë¥ | ë¶ê°ë¥ |
ì¤ëª
PIë Mathì ì ì ìì±ì´ë¯ë¡, ì¬ì©ìê° ìì±í Math ê°ì²´ì ìì±ì¼ë¡ ì ê·¼í ì ìê³ íì Math.PI를 ì¬ì©í´ì¼ í©ëë¤. (Mathë ìì±ìê° ìëëë¤)
ìì
>Math.PI ì¬ì©í기
ë¤ì í¨ìë Math.PI를 ì¬ì©í´ 주ì´ì§ ìì ë°ì§ë¦ìì ëë 를 ê³ì°í©ëë¤.
js
function calculateCircumference(radius) {
return Math.PI * (radius + radius);
}
calculateCircumference(1); // 6.283185307179586
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-math.pi> |