function hello(){
console.log("你好");
}
var timer=setInterval(hello,1000);//1秒执行一次
/************************************************/
function hello(name){
console.log("你好"+name);
}
var timer = setInterval("hello('李明')",1000);//当调用的函数带有参数时,要加引号,setTimeout与setInterval在此问题上相同
setInterval和setTimeout函数传参问题
最新推荐文章于 2021-03-03 11:27:06 发布