Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Building the Movie Object2:54 with Andrew Chalkley
In this video we'll update our Movie object to inherit from the Media object.
Finally lets create our video constructor.
This will be like our song constructor.
It will also inherent from the media constructor.
Let's create a movie js file.
And like before, lets copy and paste the code from our song into our movie.
Lets rename song to movie,
and we don't want artist, we want year.
Also for the HTML output, we want to include year in brackets.
We don't want the artist.
In our index.html, we can include movie.
And, finally, in our app.js, we can add a movie.
I'm going to add manOfSteel.
And that's a new movie with the title Man of Steel.
And it runs for a total of two hours and 23 minutes.
Then we want to add it to our playlist.
And lets test it out.
And it works.
Through this stage we've used prototypal
inheritance to extend our playlist application.
We created a generic media type that had common properties and
methods that could be used by songs and videos.
Because of this common media interface, we didn't have to change any of our other
code like our UI code in our application to create a functioning playlist.
Well then, let's solidify our skills through a practice session.
You need to sign up for Treehouse in order to download course files.Sign up