Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will make a JS console application in this assessment that queries an array of movie objects The starting folder has a module file of

You will make a JS console application in this assessment that queries an array of movie objects


The starting folder has a module file of movie data. It is imported by app.js. The global variable, movies, in app.js is your starting point. in the console You will see that it is an array of movie data.


All work will be coded in the app.js file.


Code an function that determines the average star rating of movies by genre. a. Expected input: genre b. Expected output: average star rating, formatted to 2 decimal places.


make a function that outputs the following movie stats for a given movie: title, number of actors, years passed since its release. a. Expected input: imdb_id b. Expected output: a JS Object with 3 key/value pairs - one per stat


Show your 2 functions working with the following test cases:

? Challenge 1: use the Adventure genre

? Challenge 2. use imdb_id = tt0120737


image

this is the JS starting code 

import { getMovies } from './module.mjs';      //you will use this global variable, movies, to query movie data  let movies = getMovies();  //remove this console.log once you see its data structure  console.log(movies);
this is the module file of movie data.    export function getMovies(){    return[      {        "id": 1,        "title": "The Lord of the Rings: The Fellowship of the Ring",        "imdb_id": "tt0120737",        "plot": "A meek Hobbit from the Shire and eight companions set out on a journey to destroy the powerful One Ring and save Middle-earth from the Dark Lord Sauron.",        "release": "2001-12-19",        "stars": 5,        "genre": "Adventure",        "producer": "New Line Cinema",        "actors": [          {            "act_first": "Alan",            "act_last": "Howard"          },          {            "act_first": "Noel",            "act_last": "Appleby"          },          {            "act_first": "Sean",            "act_last": "Astin"          },          {            "act_first": "Sala",            "act_last": "Baker"          },          {            "act_first": "Peter",            "act_last": "Jackson"          }        ]      },      {        "id": 2,        "title": "The Lord of the Rings: The Return of the King",        "imdb_id": "tt0167260",        "plot": "Gandalf and Aragorn lead the World of Men against Sauron's army to draw his gaze from Frodo, and Sam as they approach Mount Doom with the One Ring.",        "release": "2003-12-17",        "stars": 4,        "genre": "Adventure",        "producer": "New Line Cinema",        "actors": [          {            "act_first": "Noel",            "act_last": "Appleby"          },          {            "act_first": "Ali",            "act_last": "Astin"          },          {            "act_first": "Sean",            "act_last": "Astin"          },          {            "act_first": "David",            "act_last": "Aston"          },          {            "act_first": "Peter",            "act_last": "Jackson"          }        ]      },      {        "id": 3,        "title": "The Lord of the Rings: The Two Towers",        "imdb_id": "tt0167261",        "plot": "While Frodo,and Sam edge closer to Mordor with the help of the shifty Gollum, the divided fellowship makes a stand against Sauron's new ally, Saruman, and his hordes of Isengard.",        "release": "2002-12-18",        "stars": 4,        "genre": "Adventure",        "producer": "New Line Cinema",        "actors": [          {            "act_first": "Bruce",            "act_last": "Allpress"          },          {            "act_first": "Sean",            "act_last": "Astin"          },          {            "act_first": "John",            "act_last": "Bach"          },          {            "act_first": "Sala",            "act_last": "Baker"          },          {            "act_first": "Peter",            "act_last": "Jackson"          }        ]      },      {

there this something you have to know, you see how there is "id": 1,  "id"; 2,  "id"; 3,

id continues until   "id"; 108, 

 

so we have from "id": 1, until "id"; 108, same words same coding but different numbers.visual 

and i am using visaul studio code to get this done 

thank you 


You should dynamically generate the following output for each test case: Test Case 1 [Running] no mjs" 3.21 Test Case 2 { } title: 'The Lord of the Rings: The Fellowship of the Ring', numActors: 5, yrsSince Release: 21

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Corporate Finance What Companies Do

Authors: John Graham, Scott Smart

3rd edition

9781111532611, 1111222282, 1111532613, 978-1111222284

More Books

Students also viewed these Programming questions

Question

LO3. Explain various theories for why people commit fraud.

Answered: 1 week ago