I think you misunderstood this question. I read it as a request to add an item to the DOM, and then delay further processing until the next tick. Therefore:
document.appendChild(element); setTimeout(function() { resumeProgramFlowFromHere(); }, 0);
This is useful when you want to make sure there is a reflow / repaint before some time-consuming operation occurs (to give users visual feedback). Browsers are already forcing them to rewrite in certain circumstances , but when they do not, this method can be useful.
Here you can find more information here .
This is my interpretation of the question, but I also find it confusing, probably because it is not clear what they mean by events. And there are other contentious issues on this site, the strangest thing:
What is the concept of “functions as objects” and how does this affect the scope of a variable?
It just doesn't make sense to me. Well, functions are objects in JavaScript, and areas are also related to functions, but these are different topics. The fact that functions are objects has nothing to do with scope.
So my advice is, take these salt interviews.
source share