When an alert box is displayed, it does not stop the code
execution, so all 10 of the alert boxes are displayed but are
stacked on top of each other so you only actually see the last box,
9, on top. You can check that the loop is not going in reverse by
adding a trace(i). This will output the correct order: 0,1,2,3...