xxxxxxxxxx
//在当前页面内追加换行标签和指定的HTML内容
function w( html ){
document.body.innerHTML += "<br/>" + html;
}
function test(){
w( "test()函数定义的参数个数为" + test.length );
};
test(); // 本函数定义的参数个数为0
function foo(a, b){
w( "foo()函数定义的参数个数为" + foo.length );
foo(1, 2); // 本函数定义的参数个数为2
function bar(a, b, c, d){
w( "bar()函数定义的参数个数为" + bar.length );
// length属性只与定义函数时的参数个数有关,与调用时传入的参数个数无关
bar(); // 本函数定义的参数个数为4
// 也可在函数外部直接调用
w( foo.length ); // 2