this question has answer here:
i have function this:
var = function () { settimeout(function () { alert(2); }, 0); alert(1); } a();
the result alert 1
first, alert 2
but think, though alert(2)
in settimeout
, executes immediately,because delay 0
why alert(1)
executed first?
settimeout
has default delay cause execute after alert(1)
has executed.
Comments
Post a Comment