QUESTIONS- 1. Create and array of objects named movies . Each of the objects in the array will represent a movie. Each object should have properties for: movie title release year rating (your rating 1 - 10) genres (an array of genres. eg ["Drama", "Mystery", "Sci-Fi", "Western"] ) The array should contain at least 5 of movies you have seen (choose your own movies) You do not need to use JSON to create this array You can use IMDB if you need help finding the info for your movie 2. Now that digital format is taking over, we would like to add a property to each object for the format (“film” or “digital”). The property will be called format . Assuming that all movies in our data set where shot on film, use .forEach() to add the property and set a value of “film” for each movie. 3. Use the .map() method to create an array of movie titles from our initial data set named movieTitles . 4. Use the .reduce() method to find the highest and lowest rated movies in the data set. Store these objects in variables named highestRated and lowestRated . 5. Use the .filter() method to create an array of movies that have a rating of 7 or higher. Store this array in a variable named highlyRated . 6. Display the following in the console with text to describe each value: The title of each movie (hint: .join() to make it look nicer) The highest rated movie title and rating The lowest rated movie title and rating The titles of movies that have a rating of 7 or more (Hint: you may want to add a .map() when you output) Sample output: Movie titles: Blade Runner 2049, Blade Runner, Spectre, The Golden Compass, Sherlock Holmes Highest rated: Blade Runner (9) Lowest rated: The Golden Compass (5) Highly rated: Blade Runner 2049, Blade Runner, Spectre, Sherlock Holmes
QUESTIONS-
1. Create and array of objects named movies . Each of the objects in the array will represent a movie.
Each object should have properties for:
movie title
release year
rating (your rating 1 - 10)
genres (an array of genres. eg ["Drama", "Mystery", "Sci-Fi", "Western"] )
The array should contain at least 5 of movies you have seen (choose your own movies)
You do not need to use JSON to create this array
You can use IMDB if you need help finding the info for your movie
2. Now that digital format is taking over, we would like to add a property to each object for the format (“film” or
“digital”). The property will be called format . Assuming that all movies in our data set where shot on film, use
.forEach() to add the property and set a value of “film” for each movie.
3. Use the .map() method to create an array of movie titles from our initial data set named movieTitles .
4. Use the .reduce() method to find the highest and lowest rated movies in the data set. Store these objects in
variables named highestRated and lowestRated .
5. Use the .filter() method to create an array of movies that have a rating of 7 or higher. Store this array in a
variable named highlyRated .
6. Display the following in the console with text to describe each value:
The title of each movie (hint: .join() to make it look nicer)
The highest rated movie title and rating
The lowest rated movie title and rating
The titles of movies that have a rating of 7 or more (Hint: you may want to add a .map() when you output)
Sample output:
Movie titles: Blade Runner 2049, Blade Runner, Spectre, The Golden Compass, Sherlock Holmes
Highest rated: Blade Runner (9)
Lowest rated: The Golden Compass (5)
Highly rated: Blade Runner 2049, Blade Runner, Spectre, Sherlock Holmes
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images