How to write the correct syntax for javascript setinterval

  • 2020-03-30 03:22:19
  • OfStack

I wrote a little program the other day with setinterval, and I won't explain what that setinterval is for.

The method worked in other browsers, but was later tested by a colleague on the test team. Because they love 360 and IE. I think best not its solution within two days, IE is always reported the method parameter is wrong, then is reported to find the method, finally I found the problem!

But I really want to express my dissatisfaction strongly, the problem is that everyone online copy to copy too much, resulting in a lot of mistakes to copy later, such as
 
setInterval(QuoteList(' parameter '),3000); 

There are even
 
setInterval(QuoteList,3000,' parameter '); 

I can't help but mention the fault-tolerance of major browsers, especially firefox, maxthon, etc., which are error scripts that know you're wrong, but understand what you're saying, so they don't run wrong. But IE won't!! It doesn't know!

Because the correct way to write it is:
 
setInterval("QuoteList(' parameter ')",3000); 

This problem has been bothering me for days and I thought it was browser compatibility!

Related articles: