--- title: Function.arguments slug: Web/JavaScript/Reference/Global_Objects/Function/arguments tags: - Deprecated - Function - JavaScript - Property - arguments translation_of: Web/JavaScript/Reference/Global_Objects/Function/arguments ---
{{JSRef}} {{deprecated_header}}

La proprieta' function.arguments fa riferimento ad un oggetto simile ad un array corrispondente ai parametri passati ad una funzione. Usa questa semplice variabile {{jsxref("Functions/arguments", "arguments")}} invece. Questa proprieta' non e' disponibile in strict mode.

Descrizione

La sintassi function.arguments e' deprecata. Il metodo consigliato per accedere all'oggetto {{jsxref("Functions/arguments", "arguments")}}, disponibile all'interno delle funzioni e' semplicemente mediante l'utilizzo di {{jsxref("Functions/arguments", "arguments")}}.

In caso di ricorsione, per esempio, se la funzione f e' presente diverse volte nello stack, il valore di f.arguments rappresenta i parametri corrispondenti alla chiamata alla funzione piu' recente.

Il valore della proprieta' arguments e' normalmente null se non c'e' una sua chiamata durante l'esecuzione della funzione (ovvero quando la funzione e' stata chiamata ma non ha ancora ritornato nessun valore).

Esempi

function f(n) { g(n - 1) }

function g(n) {
  console.log('before: ' + g.arguments[0])
  if (n > 0) { f(n) }
  console.log('after: ' + g.arguments[0])
}

f(2)

console.log('returned: ' + g.arguments)

// Output

// before: 1
// before: 0
// after: 0
// after: 1
// returned: null

Specifiche

Specification Status Comment
{{SpecName('ES1')}} {{Spec2('ES1')}} Initial definition. Implemented in JavaScript 1.0. Deprecated in favor of {{jsxref("Functions/arguments", "arguments")}} in ES3.
{{SpecName('ES5.1', '#sec-10.6', 'arguments object')}} {{Spec2('ES5.1')}} {{jsxref("Functions/arguments", "arguments")}} object
{{SpecName('ES6', '#sec-arguments-object', 'arguments object')}} {{Spec2('ES6')}} {{jsxref("Functions/arguments", "arguments")}} object
{{SpecName('ESDraft', '#sec-arguments-object', 'arguments object')}} {{Spec2('ESDraft')}} {{jsxref("Functions/arguments", "arguments")}} object

Compatibilita' Browser

{{Compat("javascript.builtins.Function.arguments")}}

See also