Jack,
A do loop is when you always want the loop to run at least once. With JavaScript, the event listener gets called each time. For example, onclick gets called each time you click so you don't have to poll for it.
Note that
Java and JavaScript are different languages. For JavaScript questions, you'll want to post in the
HTML/JavaScriptforum. For Java questions, here is good.