twhite96
6/29/2017 - 1:57 AM

simple movie database to showcase js objects for The Web Developer Bootcamp

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));
});