1. 程式人生 > >【WXS資料型別】Function

【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();