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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Reza Zandi](https://secure.gravatar.com/avatar/f9a0f582d4cca78d6ce1509a2a3a6671?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Reza Zandi
Full Stack JavaScript Techdegree Student 1,599 PointsWhy does the JS alerts run first, then html?
So, a number of people have asked this, but basically the two alerts are running before my html loads.
I believe I understand why according to this link https://teamtreehouse.com/community/javascript-prompt-executing-before-documentwrite-statements
Is it that now, browsers handle JS first, then move on to HTML, no matter the order? If so, then what the video is talking about is slightly outdated then, right? :)
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYou're right, browser behavior has changed and now it's normal for the page rendering to happen only after the script is finished. There's some Teachers Notes comments about this, but not on every page. They'll eventually refresh all the courses the demonstrate the earlier behavior.
But the good news is that you'll soon learn much better techniques for user interaction that isn't subject to this issue and make the page fully responsive. You'll probably never use the more primitive methods again after that.
![Reza Zandi](https://secure.gravatar.com/avatar/f9a0f582d4cca78d6ce1509a2a3a6671?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Reza Zandi
Full Stack JavaScript Techdegree Student 1,599 PointsSweet, thanks so much for the quick answer, that clears up the confusion.