Exercise: Extending Objects

In this exercise, you will use object oriented programming concepts to extend a custom object in JavaScript.

  1. Use Codepen for this exercise, with the console open.
  2. Start with your solution from the last exercise (or copy it from here)
  3. Create a new object called MusicVideo that extends Video. Its constructor should also take in an artist argument.
  4. Instantiate a new MusicVideo object and call the watch() method on it.
  5. Add a method to MusicVideo called rockOut() that uses console.log to output a string like "You rocked out to La Bamba by Ritchie Valens!.
  6. Bonus: Use an array of data and a for loop to instantiate 5 MusicVideo objects.
  7. Bonus: Make an array of video data with both normal videos and music videos, loop through them, and decide on each one whether to make it a Video or MusicVideo object.