aboutsummaryrefslogtreecommitdiff
path: root/files/it/web/javascript/reference/global_objects/function/length
diff options
context:
space:
mode:
Diffstat (limited to 'files/it/web/javascript/reference/global_objects/function/length')
-rw-r--r--files/it/web/javascript/reference/global_objects/function/length/index.html87
1 files changed, 87 insertions, 0 deletions
diff --git a/files/it/web/javascript/reference/global_objects/function/length/index.html b/files/it/web/javascript/reference/global_objects/function/length/index.html
new file mode 100644
index 0000000000..6e305fb3ed
--- /dev/null
+++ b/files/it/web/javascript/reference/global_objects/function/length/index.html
@@ -0,0 +1,87 @@
+---
+title: Function.length
+slug: Web/JavaScript/Reference/Global_Objects/Function/length
+translation_of: Web/JavaScript/Reference/Global_Objects/Function/length
+---
+<div>{{JSRef}}</div>
+
+<p>La proprietà <code><strong>length</strong></code> indica il numero di parametri che la funzione si aspetta di ricevere.</p>
+
+<p>{{EmbedInteractiveExample("pages/js/function-length.html")}}</p>
+
+
+
+<div>{{js_property_attributes(0,0,1)}}</div>
+
+<h2 id="Description">Description</h2>
+
+<p><code>length</code> è una proprietà di un oggetto {{jsxref("Function")}} che indica quanti argomenti la funzione si aspetta, cioè il numero di parametri formali. Questo numero esclude il {{jsxref("rest_parameters", "rest parameter", "", 1)}} e include solo i parametri prima del primo con un valore predefinito. Al contrario, {{jsxref("Functions_and_function_scope/arguments/length", "arguments.length")}} è locale a una funzione e fornisce il numero di argomenti effettivamente passati alla funzione.</p>
+
+<h3 id="Data_property_of_the_Function_constructor">Data property of the Function constructor</h3>
+
+<p>Il costruttore  {{jsxref("Function")}} è esso stesso un oggetto {{jsxref("Function")}}. La sua proprietà <code>length</code> ha valore 1. Gli attributi delle proprietà sono: Writable: <code>false</code>, Enumerable: <code>false</code>, Configurable: <code>false</code>.</p>
+
+<h3 id="Property_of_the_Function_prototype_object">Property of the Function prototype object</h3>
+
+<p>La proprietà <code>length</code> del prototype di un oggetto {{jsxref("Function")}} ha valore 0.</p>
+
+<h2 id="Examples">Examples</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, rest parameter is not counted
+
+console.log((function(a, b = 1, c) {}).length);
+// 1, only parameters before the first one with
+// a default value is counted</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Definizione iniziale. Implementata in 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>Gli attributi <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">configurabili</span></font> di queste proprietà diventano <code>true</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function-instances-length', 'Function.length')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Function.length")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Function")}}</li>
+</ul>