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 Object-Oriented JavaScript: Challenge Building Constructor Methods and Generating Objects Game Class Constructor Method Solution

Why do the script tags in index.html need to be in such a specific order from the given zip files?

As of Game class Constructor solution section my index.html script tags are as follows:

<script src = "js/Space.js"></script> <script src = "js/Board.js"></script> <script src = "js/Token.js"></script> <script src = "js/Player.js"></script> <script src = "js/Game.js"></script> <script src = "js/app.js"></script>

however the original index.html is: <script src = "js/Game.js"></script> <script src = "js/Board.js"></script> <script src = "js/Space.js"></script> <script src = "js/Player.js"></script> <script src = "js/Token.js"></script> <script src = "js/app.js"></script>

why were the tags in an order that right away cause errors, unless that was part of the challenge, so we don't just carelessly flow through the exercise.

1 Answer

Steven Parker
Steven Parker
231,248 Points

The "original order" you show above is the same what you will find in the index.html file in the "Final Complete Project" folder of the project download. And it operates without error as-is.

So it sounds like you may have added something to one or more of the modules that makes it dependent on your alternate loading order.

If you'd like help spotting it, you could share a link to a workspace snapshot so we can replicate your environment.