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

Kyle Vassella
Kyle Vassella
9,033 Points

Statements are not occurring in proper order.

I have copied his code exactly, but for some reason, the document.write statement only occurs after both alerts have been clicked through.

The order should be: first alert, then the text message (header) appears, THEN the second alert. For some reason, I always get alert, alert, text message. Only after clicking 'ok' on both alerts does the text message/header appear (even though first alert is on line 1, documents.write is on line 2 and the second alert is on line 3).

Any ideas? Currently running Safari (fully upgraded)

Tushar Singh
Tushar Singh
Courses Plus Student 8,692 Points

Can you please share your code. Use markdown cheatsheet for reference.

4 Answers

Kyle Vassella
Kyle Vassella
9,033 Points

Thanks for your replies. Still having the problem: https://w.trhou.se/uef8zhai28

Still getting alert, alert, text message. Whereas the instructor gets alert, text message, alert.

Could this be an issue with my browser? He's using Chrome. I'm using a fully upgraded Safari. Or, perhaps there is an issue in the HTML file? (although I left this at default - I deleted the workspace and started from scratch to be sure).

Kyle Vassella
Kyle Vassella
9,033 Points

I'm having the same issue on the next lesson: http://w.trhou.se/fe192jb3or It seems like a bug. I copied the code exactly and initially, on the first preview it displayed correctly (alert, text message, alert).

Then I clicked preview again (without changing any code) and suddenly it's back to alert, alert, text message (text message won't appear without clicking 'okay' on both alerts first).

This is kind of frustrating. Are there known issues with Treehouse on older operating systems? I'm running Lion (my laptop is older and El Capitan makes it run extremely hot and eats battery).

Kyle Vassella
Kyle Vassella
9,033 Points

I just tested these same two workspaces on a brand new computer running El Capitan and all software fully upgraded.

I ran both workspaces in Safari, which gave me the same 'out of order' problem. I ran both on Chrome, and they ran as they should. I then tried Chrome on my older Macbook running lion, and they also ran as they should (in proper order).

This seems to be a browser issue rather than an OS issue. Are there known issues with Treehouse and Safari?