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 JavaScript Loops, Arrays and Objects Tracking Data Using Objects The Build an Object Challenge, Part 2 Solution

Matt Singleton
Matt Singleton
4,467 Points

Separate JS files not working.

When the code for the report is in the students.js file, it works perfectly.

However, when I move it to a separate file, it doesn't work. No code is changed other than the script link in the index.html file: <script src="js/student_report.js"></script>

I'm seeing no reason as to why this isn't working, please help?

https://w.trhou.se/9d2xudg12c

1 Answer

It is working for me on both IE and Chrome. Try to replicate what you have in Teamtreehouse onto Notepad and run it locally.

Also, since your JS files are linked, I don't believe you need to repeat the creation of the student variable in student_report.js.

Cheers

Matt Singleton
Matt Singleton
4,467 Points

I'm using Chrome, and the supplied code.

Tested it locally and it works: must be an issue with the browser/Treehouse.

Thanks anyway.