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 The Solution

We were taught to place the functions at the top of the file...

I was taught in previous courses of this Track to place the functions at the very top of the file, and the variables before these functions. Why not do the same with this challenges files?

And I am correct? Because if you look at the code, it looks so messy and I feel confused when trying to learn / make the challenges and apply the concepts. I mean, if you put the code like this, I believe this is the "correct version" and then what I learned was wrong or unnecesary

If moving the variable 'newTeachers' to the top was part of the challenge, there should be a hint at least... It's just overwhelming for newbies like me.

1 Answer

you're going to see lots of unexpected approaches in the wild / professional world. This works fine because of hoisting.

Best of luck and keep it going :)