--- title: Math.PI slug: Web/JavaScript/Reference/Global_Objects/Math/PI tags: - JavaScript - Math - Propriété - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI original_slug: Web/JavaScript/Reference/Objets_globaux/Math/PI ---
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:
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).
Math.PILa fonction suivante utilise Math.PI afin de calculer le périmètre d'un cercle à partir du rayon passé en argument.
function calculPérimètre(rayon) {
return 2 * Math.PI * rayon;
}
calculPérimètre(1); // 6.283185307179586
| Spécification | Statut | Commentaires |
|---|---|---|
| {{SpecName('ES1')}} | {{Spec2('ES1')}} | Définition initiale. Implémentée avec JavaScript 1.0. |
| {{SpecName('ES5.1', '#sec-15.8.1.6', 'Math.PI')}} | {{Spec2('ES5.1')}} | |
| {{SpecName('ES6', '#sec-math.pi', 'Math.PI')}} | {{Spec2('ES6')}} | |
| {{SpecName('ESDraft', '#sec-math.pi', 'Math.PI')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.Math.PI")}}