JavaScript - SetInterval doesn't function properly

前端 未结 4 1775
忘掉有多难
忘掉有多难 2021-01-13 22:40

I got this piece of script (runned locally):



        
4条回答
  •  [愿得一人]
    2021-01-13 22:52

    You need to call setInterval() without parenthesis on your function, like this:

    setInterval(uploadnew, 1000*60*5);
    

    Using parenthesis you're calling it immediately and assigning the result (undefined) to be run on an interval, instead don't use parenthesis to pass the function itself, not the result of the function.

提交回复
热议问题