Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This project focuses on the first two sections of the chapter ( array functions and prototypes / classes / modules ) . It also uses
This project focuses on the first two sections of the chapter array functions and
prototypesclassesmodules It also uses fetch to retrieve data. Figure indi cates what the
final result should look like in the browser. CHAPTER JavaScript : Additional Features
Instructions You have been provided with the necessary styling and markup already. Examine
chprojhtml in the editor of your choice. Notice the containers for the fetched data in the
and elements. Notice the sample markup for the play data. This will be eventually commented
out and replaced with JavaScript code that programmatically generates this markup. Examine
chprojjs in the editor of your choice. In it you will see the URL for the external API that
will provide the color scheme data. Examine this URL in the browser in order to see the structure
of the data. A Shakespeare play contains multiple acts; each act contains multiple scenes. To
reduce the size of the downloaded files, not all acts and scenes have been included Add a
change event handler to the first, which contains a preset list of plays. When the user selects a
play, fetch the play data by adding the value attribute of the for the play as a query string, as
shown in the comments in chprojjs When the fetched play is retrieved, populate the three
other elements from this data. Also populate the and
elements with the first scene from the first act of the selected play. When play is
selected, fetch data, then populate the other lists from the play data, and if user clicks
Filter, then only show speeches from specified player, and highlight the entered text using the
tag If user selects a different act or scene, then display it Display the current scene along
with the play and act titles FIGURE Completed Project To make the code more
manageable, create classes named Play, Act, and Scene, which will be responsible for
outputting the relevant DOM elements. Using objectoriented techniques, the Play class
will contain a list of Act objects, the Act class will contain a list of Scene objects, while the
Scene class will contain a list of speeches. These classes will reside within a JavaScript
module named playmodule.js Add event handlers to the other elements. They will
change what part of the play is displayed. The filter button will highlight all occurrences
of the userentered text in the play and only show the speeches from the specified player.
Guidance and Testing Break this problem down into smaller steps. First verify the fetch
works, perhaps with a simple console.log statement. Then populate the lists based on the
fetched data. You may decide to move your code into classes within your module after
you finished your code, or you may decide to work with classes and modules right from the
start. This latter approach was that used by the author
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started