Apply your JS skills to key Mozilla projects as an MDN Fellow! http://mzl.la/MDNFellowship

mozilla
您的搜索结果

    Function.arguments

    已废弃
    该特性已经从 Web 标准中删除,虽然一些浏览器目前仍然支持它,但也许会在未来的某个时间停止支持,请尽量不要使用该特性。

    Summary

    function.arguments 属性引用一个类数组对象(array-like object),该对象是传递给函数的实际参数。请使用变量 arguments 代替。

    Description

    The syntax function.arguments is deprecated.  The recommended way to access the arguments object available within functions is simply to refer to the variable arguments.

    In the case of recursion, i.e. if function f appears several times on the call stack, the value of f.arguments represents the arguments corresponding to the most recent invocation of the function.

    Examples

    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);
    
    
    // Output
    
    // before: 1
    // before: 0
    // after: 0
    // after: 1

    Specifications

    Specification Status Comment
    ECMAScript 1st Edition. Implemented in JavaScript 1.0. Standard Initial definition. Deprecated in favor of arguments
    ECMAScript 5.1 (ECMA-262)
    arguments object
    Standard Arguments object
    ECMAScript 6 (ECMA-262)
    arguments object
    Draft Arguments object

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

    See also

     

    文档标签和贡献者

    此页面的贡献者有: AlexChao
    最后编辑者: AlexChao,