zoukankan      html  css  js  c++  java
  • length 属性 (Function) (JavaScript)

    转载:http://msdn.microsoft.com/zh-cn/library/4cz6db7d(v=vs.94).aspx

    获取为一个函数定义的参数数目。

    functionName.length

    备注

    必要的 functionName 是该函数的名称。

    创建函数的实例后,脚本引擎将该函数的 length 属性初始化为该函数定义中的参数数量。

    调用函数时,如果其参数数量与其 length 属性的值不同,则发生的情况取决于该函数。

    示例

    下面的示例阐释了 length 属性的用法:

     1 function ArgTest(a, b){
     2     var s = "";
     3 
     4     s += "Expected Arguments: " + ArgTest.length;
     5     s += "<br />";
     6     s += "Passed Arguments: " + arguments.length;
     7 
     8     return s;
     9 }
    10 
    11 document.write(ArgTest(1, 2));
    12 
    13 // Output: 
    14 // Expected Arguments: 2
    15 // Passed Arguments: 2

    要求

    在以下文档模式中受支持:Quirks、Internet Explorer 6 标准模式、Internet Explorer 7 标准模式、Internet Explorer 8 标准模式、Internet Explorer 9 标准模式、Internet Explorer 10 标准模式和 Internet Explorer 11 标准模式。此外,也在应用商店应用(Windows 8 和 Windows Phone 8.1)中受支持。

  • 相关阅读:
    7.python常用模块
    7.python3实用编程技巧进阶(二)
    7.Flask文件上传
    7.Django CSRF 中间件
    7.Ajax
    6.python内置函数
    6.python3实用编程技巧进阶(一)
    6.jQuery(实例)
    PhpStorm 10.0.1破解激活步骤
    PyCharm 2018.1破解激活步骤
  • 原文地址:https://www.cnblogs.com/johnnylion/p/3937523.html
Copyright © 2011-2022 走看看