// Create movie DB
var movies = [
{
title: "Avengers",
hasWatched: true,
rating: 5
},
{
title: "SpiderMan",
hasWatched: false,
rating: 4
},
{
title: "LightsOut",
hasWatched: true,
rating: 6
}
]
// Print it out
movies
// Print out all of them
movies.forEach(function(movie)){
var result = "You have ";
if(movie.hasWatched){
result += "watched ";
}else{
result += "not seen ";
}
result += "\" + movie.title + "\"-";
result += movie.rating + " stars";
console.log(result);
}
Why my first Object is true but the console print out " You have not seen "Avengers" - 5 stars "