simple movie database to showcase js objects for The Web Developer Bootcamp
var movies = [
{
title: "Taxi Driver",
hasWatched: true,
rating: 5
},
{
title: "The Social Network",
hasWatched: true,
rating: 5
},
{
title: "Steve Jobs",
hasWatched: true,
rating: 4.5
}
];
function stringBuilder(movie) {
var result = "You have ";
if (movie.hasWatched) {
result += "watched";
} else {
result += "has not seen";
}
result += '"' + movie.title + '" - ';
result += movie.rating + " stars";
}
movies.forEach(function(movie) {
console.log(stringBuilder(movie));
});