Math.PI - JavaScript | MDN
Maybe your like
- Skip to main content
- Skip to search
Cette page a été traduite à partir de l'anglais par la communauté. Vous pouvez contribuer en rejoignant la communauté francophone sur MDN Web Docs.
View in English Always switch to English
Math.PI Baseline Widely availableCette fonctionnalité est bien établie et fonctionne sur de nombreux appareils et versions de navigateurs. Elle est disponible sur tous les navigateurs depuis juillet 2015.
- Learn more
- See full compatibility
- Report feedback
La propriété Math.PI représente le ratio entre le périmètre d'un cercle et son diamètre. Elle vaut environ 3.14159:
Dans cet article
- Exemple interactif
- Description
- Exemples
- Spécifications
- Compatibilité des navigateurs
- Voir aussi
Exemple interactif
function calculateCircumference(radius) { return 2 * Math.PI * radius; } console.log(Math.PI); // Expected output: 3.141592653589793 console.log(calculateCircumference(10)); // Expected output: 62.83185307179586| Attributs de Math.PI | |
|---|---|
| Écrivable | Non |
| Énumérable | Non |
| Configurable | Non |
Description
PI est une propriété statique de l'objet Math et doit toujours être utilisée avec la syntaxe Math.PI plutôt que d'être appelée comme la propriété d'un autre objet qui aurait été crée (Math n'est pas un constructeur).
Exemples
Utiliser Math.PI
La fonction suivante utilise Math.PI afin de calculer le périmètre d'un cercle à partir du rayon passé en argument.
jsfunction calculPérimètre(rayon) { return 2 * Math.PI * rayon; } calculPérimètre(1); // 6.283185307179586Spécifications
| Specification |
|---|
| ECMAScript® 2026 Language Specification# sec-math.pi |
Compatibilité des navigateurs
Voir aussi
- Math
Help improve MDN
Cette page vous a-t-elle été utile ? Yes No Learn how to contributeCette page a été modifiée le 17 févr. 2025 par les contributeurs du MDN.
View this page on GitHub • Report a problem with this content Filter sidebar- Objets natifs standards
- Math
- Méthodes statiques
- Math.abs()
- Math.acos()
- Math.acosh()
- Math.asin()
- Math.asinh()
- Math.atan()
- Math.atan2()
- Math.atanh()
- Math.cbrt()
- Math.ceil()
- Math.clz32()
- Math.cos()
- Math.cosh()
- Math.exp()
- Math.expm1()
- f16round()
- Math.floor()
- Math.fround()
- Math.hypot()
- Math.imul()
- Math.log()
- Math.log1p()
- Math.log2()
- Math.log10()
- Math.max()
- Math.min()
- Math.pow()
- Math.random()
- Math.round()
- Math.sign()
- Math.sin()
- Math.sinh()
- Math.sqrt()
- sumPrecise()
- Math.tan()
- Math.tanh()
- Math.trunc()
- Propriétés statiques
- Math.E
- Math.LN2
- Math.LN10
- Math.LOG2E
- Math.LOG10E
- Math.PI
- Math.SQRT1_2
- Math.SQRT2
Tag » Approximation Of Pi Javascript
-
How To Calculate An Approximation Of Pi (π) With JavaScript (Solution ...
-
Javascript: PI (π) Calculator - Math - Stack Overflow
-
A Million Digits Of Pi In 9 Lines Of Javascript
-
Estimating Pi In JavaScript - CodeDrome
-
Calculate PI By Measuring The Area Of A Circle ... In JavaScript
-
How To Get The Value Of PI In JavaScript? - Tutorialspoint
-
Calculate PI In JavaScript ... By Throwing Darts - CodeGuppy
-
JavaScript: Math.PI Property - TechOnTheNet
-
Compute Pi With Javascript And Big.js - Compulsive Coders
-
Calculating Pi Using The Monte Carlo Method In JavaScript · GitHub
-
JavaScript - Math.PI Property Example - Dirask
-
How To Get The Value Of PI Using JavaScript - Javatpoint
-
Calculate Pi Using Nilkantha's Series - GeeksforGeeks
-
Coding Challenge #95: Approximating The Value Of Pi - YouTube