You've got many valid answers in here but none of them really tells you why it works as it does.
In JavaScript commands are executed one at a time, synchronously in the order they come, unless you explicitly tell them to be asynchronous by using a timeout or interval.
This means that your .append
method will be executed and nothing else (disregarding any potential timeouts or intervals that may exist) will execute until that method have finished its job.
To summarize, there's no need for a callback since .append
will be run synchronously.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…