Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Why 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.
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? :)
Steven Parker210,443 Points
You'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.
Sweet, thanks so much for the quick answer, that clears up the confusion.