Giter Club home page Giter Club logo

assignment-unit-5.3's Introduction

Unit 5, Part 3: Music Collection

This unit, we'll be exploring objects by creating an application to help maintain a record collection. We will be creating objects using object literal syntax.

Topics Covered

  • objects
  • HTML & CSS

Part 3 - Building a Music Collection

Update the 3-music-collection.js file to do the following:

While working through the features below, make sure to commit after you complete a task! Your commit message should reflect what you added or changed since the previous commit.

Required Features

  • Create a variable collection that starts as an empty array.

  • Add a function named addToCollection. This function should:

    • Take in the album's title, artist, yearPublished as input parameters
    • Create a new object having the above properties
    • Add the new object to the end of the collection array
    • Return the newly created object
  • Test the addToCollection function:

    • Add 6 albums to your collection. Aim to have a mix of both same and different artists and published years. (Feel free to share your musical interests, or make stuff up. Totally fine either way.)
    • Console.log each album as added using the returned value.
    • After all are added, console.log the collection array.
  • Add a function named showCollection. This function should:

    • Take in an array parameter. (This allows it to be reused to show any collection, like the results from the find or search.)
    • Console.log the number of items in the array.
    • Loop over the array and console.log each album's information formatted like: TITLE by ARTIST, published in YEAR.
  • Test the showCollection function.

  • Add a function named findByArtist. This function should:

    • Take in artist (a string) parameter
    • Create an array to hold any results, empty to start
    • Loop through the collection and add any objects with a matching artist to the array.
    • Return the array with the matching results. If no results are found, return an empty array.
  • Test the findByArtist function. Make sure to test with an artist you know is in the collection, as well as an artist you know is not in your collection. Check that for artists with multiple matches, all are found.

When testing your functions, write all tests in the JavaScript file!

Stretch goals

  • Create a function called search. This function should:

    • Take an input parameter for a search criteria object. Create your solution based on a search object that has these properties:
    { artist: 'Ray Charles', year: 1957 }
    
    • The returned output from search should meet these requirements:
      • Return a new array of all items in the collection matching all of the search criteria.
      • If no results are found, return an empty array.
      • If there is no search object or an empty search object provided as input, then return all albums in the collection.
  • Add an array of tracks to your album objects. Each track should have a name and duration. You will need to update the functions to support this new property:

    • Update the addToCollection function to also take an input parameter for the array of tracks.
    • Update search to allow a trackName search criteria.
      • IF the search object has a trackName property, only search for that, ignoring any artist or year properties.
    • Update the showCollection function to display the list of tracks for each album with its name and duration.
    TITLE by ARTIST, published in YEAR:
    1. NAME: DURATION
    2. NAME: DURATION
    3. NAME: DURATION
    TITLE by ARTIST, published in YEAR:
    1. NAME: DURATION
    2. NAME: DURATION

Make sure to test all your code!

Assignment Submission

Check in your repo, then turn in your work via the Prime Academy Assignment Application at http://primeacademy.io, as usual and don't hesitate to hit up the Slack channel as needed!

assignment-unit-5.3's People

Contributors

kdszafranski avatar elijahlawson avatar doctorhowser avatar mbmosman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.