87,904
社区成员
发帖
与我相关
我的任务
分享
var userName="jack";
//根据用户名显示欢迎信息
function hello(_name){
alert("hello,"+_name);
}
//创建一个函数,用于返回一个无参数函数
function _hello(_name){
return function(){
hello(_name);
}
}
window.setTimeout(_hello(userName),3000);
window.setTimeout(_hello(userName),3000); //延时3秒后执行,只执行一次
window.setInterval(_hello(userName),3000); //每隔3秒执行一次