diff options
| author | julieng <julien.gattelier@gmail.com> | 2021-08-03 08:03:09 +0200 |
|---|---|---|
| committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-09-03 08:08:25 +0200 |
| commit | 844f5103992238c0c23203286dad16a466e89c97 (patch) | |
| tree | d537708951bb2b61be8192ffacc05a0ce6804f89 /files/fr/web/javascript/reference/global_objects/function/length/index.html | |
| parent | a70fd5b73ecb10bec3906640023e2a1a46e118a2 (diff) | |
| download | translated-content-844f5103992238c0c23203286dad16a466e89c97.tar.gz translated-content-844f5103992238c0c23203286dad16a466e89c97.tar.bz2 translated-content-844f5103992238c0c23203286dad16a466e89c97.zip | |
move *.html to *.md
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/function/length/index.html')
| -rw-r--r-- | files/fr/web/javascript/reference/global_objects/function/length/index.html | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/function/length/index.html b/files/fr/web/javascript/reference/global_objects/function/length/index.html deleted file mode 100644 index 7493f7d759..0000000000 --- a/files/fr/web/javascript/reference/global_objects/function/length/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: Function.length -slug: Web/JavaScript/Reference/Global_Objects/Function/length -tags: - - Function - - JavaScript - - Propriété - - Reference -translation_of: Web/JavaScript/Reference/Global_Objects/Function/length -original_slug: Web/JavaScript/Reference/Objets_globaux/Function/length ---- -<div>{{JSRef}}</div> - -<p>La propriété <code><strong>length</strong></code> définit le nombre de paramètres attendus par la fonction.</p> - -<div>{{EmbedInteractiveExample("pages/js/function-length.html")}}</div> - - - -<div>{{js_property_attributes(0,0,1)}}</div> - -<h2 id="Description">Description</h2> - -<p><code>length</code> est une propriété des fonctions qui indique le nombre d'arguments attendus par la fonction (ce qui correspond au nombre d'arguments formellement déclarés). Cette quantité n'inclue pas les {{jsxref("Fonctions/paramètres_du_reste", "paramètres du reste", "", 1)}} et ne compte que les paramètres situés avant le premier paramètre avec une valeur par défaut. Cette propriété est différente de {{jsxref("Fonctions/arguments/length", "arguments.length")}} qui est locale à la fonction et qui décrit le nombre d'arguments réellement passés à la fonction.</p> - -<h3 id="Propriété_du_constructeur_Function">Propriété du constructeur <code>Function</code></h3> - -<p>Le constructeur {{jsxref("Function")}} est lui-même un objet {{jsxref("Function")}}. Sa propriété<code> length</code> vaut 1. Les attributs de cette propriété sont : Écrivable : <code>false</code>, Énumérable : <code>false</code>, Configurable : <code>true</code>.</p> - -<h3 id="Propriété_du_prototype_de_Function">Propriété du prototype de <code>Function</code></h3> - -<p>La propriété <code>length</code> du prototype de {{jsxref("Function")}} vaut 0.</p> - -<h2 id="Exemples">Exemples</h2> - -<pre class="brush: js">console.log(Function.length); /* 1 */ - -console.log((function() {}).length); /* 0 */ -console.log((function(a) {}).length); /* 1 */ -console.log((function(a, b) {}).length); /* 2 etc. */ -console.log((function(...args) {}).length); -// 0, le paramètre du reste n'est pas compté -console.log((function(a, b = 1, c) {}).length); -// 1, seuls les paramètres avant les valeurs par -// défaut sont comptés -</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.1.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.3.5.1', 'Function.length')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-function-instances-length', 'Function.length')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>L'attribut <code>configurable</code> de cette propriété vaut <code>true</code> désormais.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function-instances-length', 'Function.length')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("javascript.builtins.Function.length")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>{{jsxref("Function", "Function")}}</li> -</ul> |
