Function.length

December 06, 2007category: JavaScript 

"JavaScript Method Overloading" を読んで、Function.length の存在を知る。 Function.length には、関数に明示的に定義された引数の数が入る。

var hoge = function(foo, bar) {
  console.log(arguments.length); // => 1
  console.log(arguments.callee.length); // => 2
}
console.log(hoge.length); // => 2
hoge(100);

comments (0)

comments