MyFunction() vs window.setTimeout('MyFunction()', 0)?

前端 未结 3 1061
清酒与你
清酒与你 2020-12-08 16:53

In javascript, is there any different between these two:

// call MyFunction normal way 

MyFunction();

// call MyFunction with setTimeout to 0 //

window.se         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 17:44

    I would guess that the timeout only starts when the page is fully loaded, whereas just a plain 'MyFunction()' will execute as soon as it's processed.

提交回复
热议问题