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.

JavaScript AJAX Basics (retiring) jQuery and AJAX The Office Status Project Revisited

Jonathan Healy
Jonathan Healy
21,601 Points

Any particular reason the Employee Status is addressed prior to adding the Employee's Name to the loop?

Just peaking at the code, and wondering why since the employee's name is the first property listed in each object, it isnt added to the loop code prior to checking the state of the office status? Just curious if there is any particular reasoning behind this?

1 Answer

Christopher Ford
Christopher Ford
3,407 Points

Hi Jonathan,

The order of the key:value pairs in an object don't really matter too much in the context of how you handle the data elsewhere. In this case, we need to check on the status of the room booking first as this will determine the class that is given to each <li>, and then the name becomes a child of that tag.

In general, don't worry too much about the order of an object's properties, just access them in the most logical way when you want to make use of them in the wild.

I hope this helps, Chris