Skip to content

Function updateRecords keeps updated your musical album collection represented by a JSON object. Each album has a unique id number as its key and several other properties like artist or tracks.

Notifications You must be signed in to change notification settings

candytale55/Record-Collection_FCC_JS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Record-Collection_FCC_JS

Function updateRecords keeps updated your musical album collection represented by a JSON object. Each album has a unique id number as its key and several other properties like artist or tracks.

General info

The purpose of the project is just personal learning.

Description

You are get a JSON object collection representing a part of your musical album collection. Each album in the collection has a unique id number as its key and several other properties. Not all albums have complete information.

updateRecords function takes an object like collection, an id, a prop (like artist or tracks), and a value that it must update. The function must:

  • Always return the entire object.
  • If prop isn't tracks, and value isn't an empty string, it updates or set that album's prop to value.
  • If prop is tracks but the album doesn't have a tracks property, create an empty array and add value to it. Uses hasOwnProperty to check first if the album has property "tracks".
  • If prop is tracks, and value isn't an empty string, add value to the end of the album's existing tracks array.
  • If value is an empty string, delete the given prop property from the album.

To-do list:

  • Do the same on Python
  • There's another possible solution here - must check it.

Technologies

  • Javascript ES6

Setup

NA - It's only coding examples, there's no setup.

Status

Project is: in progress - Kept for reference.

References

Based on FreeCodeCamp's excercise Record Collection from subsection JavaScript Algorithms and Data Structures (Basic JavaScript section). I worked on this on year 2021.

About

Function updateRecords keeps updated your musical album collection represented by a JSON object. Each album has a unique id number as its key and several other properties like artist or tracks.

Topics

Resources

Stars

Watchers

Forks