set time out not working with function

前端 未结 4 1804
予麋鹿
予麋鹿 2021-01-20 03:23

I am using the following to pause the javascript for a few seconds:

 setTimeout(start_countdown(),3000);

It does not work, the function is

4条回答
  •  臣服心动
    2021-01-20 03:53

    If you dont need to pass params dont use ()

    setTimeout(start_countdown,3000);
    

    If you do you have to wrap your function

    setTimeout(function(){start_countdown(parameter)},3000);
    

提交回复
热议问题