var addtt=add1;//函数名当变量使用,可以赋值,也可以传值
//addtt 指向了函数体
addtt();
//==================js中函数的两种定义方式和函数变量赋值================
//==================将函数变量作为参数传递===========================
//基本格式:
function add2(fun){
//将函数名作为参数传递
fun();
}
add2(add1);
//--------------------------------------
//函数名作参数使用,同时接受参数的情况演示的啦
function add(a){
return n+10;
}
//a:数字,fun:函数
function addTest(a,fun){
var t=fun(a);
return t;
}
var tt=addTest(22,add);//这样的写法也是ok的啦
alert(tt);
//==================将函数变量作为参数传递===========================
script>