Function関数が期待する引数の数を取得するサンプル


Function.lengthでFunction関数が期待する引数の数を取得します
var testfunc1 = function(){
}
var testfunc2 = function(a,b){
}
var testfunc3 = function(a,b,c){
}

document.write('

testfunc1:' + testfunc1.length + '

'); document.write('

testfunc2:' + testfunc2.length + '

'); document.write('

testfunc3:' + testfunc3.length + '

');

Function.lengthテスト

See the Pen Function関数が期待する引数の数を取得する by yochans (@yochans) on CodePen.

0 件のコメント :

コメントを投稿