Movatterモバイル変換


[0]ホーム

URL:


  1. Tecnologia Web para desenvolvedores
  2. JavaScript
  3. Referência JavaScript
  4. Objetos Globais
  5. Function
  6. Function.arguments

Esta página foi traduzida do inglês pela comunidade.Saiba mais e junte-se à comunidade MDN Web Docs.

View in EnglishAlways switch to English

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 thecompatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

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

Descrição

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

No caso de recursão, ou seja, uma função f aparecer várias vezes na pilha de chamadas, o valor def.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

Veja também

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp