Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you misunderstood the question. I read it as asking to append an element to the DOM, then delay any further processing until the next tick. Therefore:</p> <pre><code>document.appendChild(element); setTimeout(function() { resumeProgramFlowFromHere(); }, 0); // nothing here </code></pre> <p>That's useful when you want to make sure there is a reflow/repaint <em>before</em> some time-consuming operation takes place (to give users visual feedback). Browsers already force a repaint in <a href="https://stackoverflow.com/questions/510213/when-does-reflow-happen-in-a-dom-environment">certain circumstances</a>, but when they don't, this technique can be useful.</p> <p>You can find some more information <a href="https://stackoverflow.com/questions/510213/when-does-reflow-happen-in-a-dom-environment">here</a> and <a href="https://stackoverflow.com/questions/15205725/alternatives-to-re-flow-and-re-paint">here</a>.</p> <hr> <p>That's my interpretation of the question, but I find it confusing too, probably because it's not clear what they mean by <em>events</em>. And there are other debatable questions on that site, the weirdest being:</p> <blockquote> <p><em>What is the concept of “functions as objects” and how does this affect variable scope?</em></p> </blockquote> <p>That simply makes no sense to me. Okay, functions are objects in JavaScript, and scopes are also related to functions, but those are distinct topics. The fact that functions are objects has nothing to do with scope.</p> <p>So my advice is, take those interview questions with a grain of salt.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload