addloadevent(function(){styleElementSibling(})styleElement已经是函数为什么要放在匿名函数里
1 回答

收到一只叮咚
TA贡献1821条经验 获得超5个赞
这跟调用有关,比如我定义一个类似事件的东西,需要指定一个回调
function test(callback) { callback("test"); }
现在你有一个函数,
function sayHello(name) { if (name) { console.log("hello", name); } else { console.log("hello world"); } }
请注意有没有传入参数的区别
然后调用
test(sayHello); test(function() { sayHello(); });
其结果是不一样的
添加回答
举报
0/150
提交
取消