Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Introducing JavaScript Where Does JavaScript Go?

Christopher Kajioka
Christopher Kajioka
335 Points

When I preview it, it does not display the alerts in the same order as the video (even if I move it to the bottom).

It seems to always display the "alert" commands first, followed by the text on the pages. No matter what order I put them in.

1 Answer

Steven Parker
Steven Parker
231,275 Points

It's normal for modern browsers to defer page rendering until the script finishes running. So any alert's will show as they are executed, but anything written to the page will only show up when the script is done.

This is a change from browsers not to long ago which would render the page and run the script at the same time.

But if you continue with your studies, you will soon learn much better and more interactive techniques for communicating with the user.