Question: Normally in a web application, we would store our data in a database. We don't have a database in this class, but we can fake

Normally in a web application, we would store our data in a database. We don't have a database in this class, but we can fake it. So let's do so.

1. Begin by creating a file called store.js and store it in the js folder. Create an empty array in your store.js file to represent our database. Make sure you declare it globally so it can be accessed in all the functions. This is normally a bad thing but we will forgive ourselves this one time.

2. Create several album objects with the following properties.

id

title

artist

price

release date

Quantity

Tracklisting (should be an array)

3. Once you've created your fake albums, add them to the array representing the database.

Part B:

1. Create a file called search.js.

2. Create an event listener in the search.js script that is handled by a function called search that handles the onclick event for the submit button for the search.

3. When I type an artist name (I'm only going to search by artist name right now), in the

search box and hit submit, your search function should loop through the fake database of albums in the store.js file. You can handle this many cools ways. I would suggest creating a store object and adding functions to it. The global array would then be visible to the other scripts on the page. As you iterate through the database array check for the ones that match the artist that was entered in the search box. Open a new page and display the results in a list on that page. You will need to use dom manipulation for this part.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!