function test(){
console.log("这是一段非常流皮的代码");
}
//2.1命名函数表达式(表达式忽略它的名字)
var test = function fun2(){
document.write();
}
//2.2匿名函数表达式,常用
var test2 = function (){
document.write();
}
//形参和实参的数目可以不匹配,实参给多少用多少
function fun(arg1, arg2){
if(arguments.length > fun.length){
console.log("实参多于形参");
}else{
console.log("形参多于或者等于实参");
}
//遍历实参
for(var index = 0; index < arguments.length; index++){
console.log(arguments[index]);
}
}
fun(1,"2",3);
原文:https://www.cnblogs.com/Bai-Bai/p/12112219.html