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 (2015) Prototypal Inheritance Building the Movie Object

Niall Maher
Niall Maher
16,985 Points

Uncaught ReferenceError: Media is not defined

I'm getting the following error when I try my code "Uncaught ReferenceError: Media is not defined"

Here's a screenshot of my work so hopefully someone can end my headache :/

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

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

In your index.html your script tag for media.js is after all the rest so it will be the last one loaded. If it's not loaded by the time the other scripts call on Media, then it will cause that error. Since it's the base class for Song and Movie it should be loaded before them.

Niall Maher
Niall Maher
16,985 Points

Thanks bro! Not used to using so many separate files :P