From 8b689a0824d94914e10f365a188190ec5c621309 Mon Sep 17 00:00:00 2001 From: antwonlee Date: Wed, 1 Jun 2016 02:02:50 -0500 Subject: [PATCH] Add more inheritance and prototype chain :earth_africa: --- object_oriented_javascript/playlist/app.js | 2 ++ object_oriented_javascript/playlist/movie.js | 22 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 object_oriented_javascript/playlist/movie.js diff --git a/object_oriented_javascript/playlist/app.js b/object_oriented_javascript/playlist/app.js index 04b3e9d..6619a23 100644 --- a/object_oriented_javascript/playlist/app.js +++ b/object_oriented_javascript/playlist/app.js @@ -2,9 +2,11 @@ var playlist = new Playlist(); var hereComesTheSun = new Song("Here Comes the Sun", "The Beatles", "2:54"); var walkingOnSunshine = new Song("Walking on Sunshine", "Katrina and the Wave", "3:43"); +var manOfSteel = new Movie("Man of Steel", 2013, "2:23:00"); playlist.add(hereComesTheSun); playlist.add(walkingOnSunshine); +playlist.add(manOfSteel); var playlistElement = document.getElementById("playlist"); diff --git a/object_oriented_javascript/playlist/movie.js b/object_oriented_javascript/playlist/movie.js new file mode 100644 index 0000000..257192a --- /dev/null +++ b/object_oriented_javascript/playlist/movie.js @@ -0,0 +1,22 @@ +function Movie(title, artist, duration) { + Media.call(this, title, duration); + this.year = year; +} + +Movie.prototype = Object.create(Media.prototype); + +Movie.prototype.toHTML = function() { + var htmlString = '