In this exercise, you will take an app and split it into a Model and View.
Go through these steps, and do as many as you can in the time we have:
VideoModel
object that represents a video.
Your model object should take in a JSON object
and store title, author, and youtubeID properties. It should also calculate
an embed and thumbnail URL.
VideoCollection
object that represents a collection of videos.
It should take in JSON and turn it into
an internal items
array of VideoModel
instances.
document.ready
to create a new instance of a VideoCollection
,
using the data from the videosJSON
array stored in the page.
VideoCollection
and
pass them to the addVideoToList
function.
addVideoToList
function.
items
based on title. (Hint: Check out String.localeCompare).
Call the sort()
method on the collection before displaying them.
Make sure that you use your browser developer tools to make debugging easier while working on this. Check for errors, and use console.log() to figure out how far your code makes it, and what the values of your variables are along the way.