Friday, May 06, 2011

TIL: In JavaScript function.length returns the number of arguments it supports

function test(a, b, c)
{

}

alert(test.length);

In this piece of code if you use .length on a function it returns the number of named arguments that this function accepts.