Function.arguments

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

A propriedade function.arguments diz respeito a um objeto tipo array (array-like object) correspondente aos argumentos passados para uma função. Use somente a variável arguments em vez disso.

Descrição

A sintaxe function.arguments está obsoleta. A forma recomendada de acessar o objeto arguments disponível dentro das funções, é simplesmente referenciar a variável arguments.

No caso de recursão, ou seja, uma função f aparecer várias vezes na pilha de chamadas, o valor de f.arguments representa os argumentos correspondentes a invocação mais recente da função.

O valor da propriedade arguments é normalmente nulo (null) se não houver nenhuma invocação pendente da função em andamento (ou seja, a função foi chamada mas ainda não retornou).

Exemplos

js
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

Especificações

Não faz parte de nenhuma especificação.

Compatibilidade com navegadores

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
arguments
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.

Veja também