js 函数的陷阱
时间:2014-06-29 14:21:45
收藏:0
阅读:271
function test(){
return "hello";
}
alert(test);这个显示是变量test的值,它正好是个函数,这是第一个警告对话框显示的结果:
function test(){
return "hello";
}
alert(test());
圆括号()告诉它执行函数test,并显示它的返回值,就像下面这样:
hello;
function addInput(name,value){
do something;
}
alert(addInput);
var testCall=addInput;
testCall(‘name‘,‘value‘);
他们指向同一个函数。
x[i].onkeyup=x[i].onchange=checkMaxLength;
评论(0)