aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/math/floor
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 12:36:08 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 12:36:08 +0100
commit39f2114f9797eb51994966c6bb8ff1814c9a4da8 (patch)
tree66dbd9c921f56e440f8816ed29ac23682a1ac4ef /files/fr/web/javascript/reference/global_objects/math/floor
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.gz
translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.bz2
translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.zip
unslug fr: move
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/math/floor')
-rw-r--r--files/fr/web/javascript/reference/global_objects/math/floor/index.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/math/floor/index.html b/files/fr/web/javascript/reference/global_objects/math/floor/index.html
new file mode 100644
index 0000000000..0058ccfe84
--- /dev/null
+++ b/files/fr/web/javascript/reference/global_objects/math/floor/index.html
@@ -0,0 +1,100 @@
+---
+title: Math.floor()
+slug: Web/JavaScript/Reference/Objets_globaux/Math/floor
+tags:
+ - JavaScript
+ - Math
+ - Méthode
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/floor
+---
+<div>{{JSRef}}</div>
+
+<p>La fonction <code><strong>Math.floor(x)</strong></code> renvoie le plus grand entier qui est inférieur ou égal à un nombre <code>x</code>.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/math-floor.html")}}</div>
+
+<p class="hidden">Le code source de cet exemple interactif est disponible dans un dépôt GitHub. Si vous souhaitez contribuez à ces exemples, n'hésitez pas à cloner <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> et à envoyer une <em>pull request</em> !</p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox">Math.floor(<var>x</var>)</pre>
+
+<h3 id="Paramètres">Paramètres</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>Un nombre.</dd>
+</dl>
+
+<h3 id="Valeur_de_retour">Valeur de retour</h3>
+
+<p>Un nombre qui représente le plus grand entier inférieur ou égal à la valeur passée en argument.</p>
+
+<h2 id="Description">Description</h2>
+
+<p><code>floor()</code> est une méthode statique de l'objet <code>Math</code>, elle doit toujours être utilisée avec la syntaxe  <code>Math.floor()</code>, elle ne doit pas être utilisée avec un autre objet qui aurait été créé (<code>Math</code> n'est pas un constructeur).</p>
+
+<div class="blockIndicator note">
+<p><strong>Note :</strong> <code>Math.floor(null)</code> renvoie <code>0</code> et pas {{jsxref("NaN")}}.</p>
+</div>
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="Utiliser_Math.floor">Utiliser <code>Math.floor</code></h3>
+
+<pre class="brush:js">Math.floor( 45.95); // 45
+Math.floor( 45.05); // 45
+Math.floor( 4 ); // 4
+Math.floor(-45.05); // -46
+Math.floor(-45.95); // -46
+Math.floor(null); // 0
+</pre>
+
+<h2 id="Spécifications">Spécifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Spécification</th>
+ <th scope="col">État</th>
+ <th scope="col">Commentaires</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Définition initiale. Implémentée avec JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.9', 'Math.floor')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.floor', 'Math.floor')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.floor', 'Math.floor')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
+
+<p class="hidden">Le tableau de compatibilité de cette page a été généré à partir de données structurées. Si vous souhaitez contribuer à ces données, n'hésitez pas à envoyer une <em>pull request</em> sur <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Math.floor")}}</p>
+
+<h2 id="Voir_aussi">Voir aussi</h2>
+
+<ul>
+ <li>{{jsxref("Math.abs()")}}</li>
+ <li>{{jsxref("Math.ceil()")}}</li>
+ <li>{{jsxref("Math.round()")}}</li>
+ <li>{{jsxref("Math.sign()")}}</li>
+ <li>{{jsxref("Math.trunc()")}}</li>
+</ul>