top of page

JavaScript Practice Set-2




1. Create and array of objects named movies. Each of the objects in the array will represent a movie. The array should contain at least 6 movies you have seen (choose your own movies) You can use IMDB.com if you need help finding the info for your movie Each object should have properties for: movie title (string) release year (number) rating (your rating, a number 1 - 10) genres (an array of strings. eg ["Drama", "Mystery", "Sci-Fi", "Western"])


2. Now go back and add the property "format" with the value "digital" to a couple of the newer movies in the array (but not all of them).


3. Now that digital format has taken over, we would like to add the "format" property to each object that does not already have it. Use .forEach() to add the property "format" with a value of "film" for each movie that does not already have the property.


4. Use the .sort() method to sort the array of movies by rating, best to worst. Make sure that at least one of your movies has a rating of 10.


5. Use the .map() method to create an array of movie titles from our initial data set named movieTitles.


6. 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.


7. 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.


8. Display the following in the console, using template literals, 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


Sample Output:


(Don't use these titles in your assignment, use your own.) Movie titles: Blade Runner, Sherlock Holmes, Spectre, Blade Runner 2049, Soul, The Golden Compass Highest rated: Blade Runner (10) Lowest rated: The Golden Compass (5) Highly rated: Blade Runner, Sherlock Holmes, Spectre, Blade Runner 2049


Contact us for this JavaScript assignment Solutions by Codersarts Specialist who can help you mentor and guide for such JavaScript assignments.


If you have project or assignment files, You can send at contact@codersarts.com directly

bottom of page