setInterval和setTimeout函数传参问题

来源:互联网 发布:cnstorm知乎 编辑:程序博客网 时间:2024/05/22 07:23
function hello(){  console.log("你好");}var timer=setInterval(hello,1000);//1秒执行一次/************************************************/function hello(name){console.log("你好"+name);}var timer = setInterval("hello('李明')",1000);//当调用的函数带有参数时,要加引号,setTimeout与setInterval在此问题上相同



0 0
原创粉丝点击