【WXS数据类型】Function

属性:

名称 值类型 说明
[Function].constructor [String] 返回值为“Function”,表示类型的结构字符串
[Function].length [Number] 返回函数的形参个数。

方法:

原型:[Function].toString()
说明:返回字符串:[function Function]

 

function 里面可以使用 arguments 关键词。该关键词目前只支持以下的属性:

length: 传递给函数的参数个数。

[index]: 通过 index 下标可以遍历传递给函数的每个参数。

示例:

function test(){
    console.log( arguments.length); // 参数个数
    console.log( arguments[0]);// 第一个参数值                
};

test();

 

posted @ 2018-11-05 15:53  1024记忆  阅读(581)  评论(0)    收藏  举报