diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md index af5bb96e72a..3016ba58634 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md @@ -8,17 +8,24 @@ dashedName: record-collection # --description-- -You are given an object literal representing a part of your musical album collection. Each album has a unique id number as its key and several other properties. Not all albums have complete information. +You are creating a function that aids in the maintenance of a musical album collection. The collection is organized as an object that contains multiple albums which are also objects. Each album is represented in the collection with a unique `id` as the property name. Within each album object, there are various properties describing information about the album. Not all albums have complete information. -You start with an `updateRecords` function that takes an object literal, `records`, containing the musical album collection, an `id`, a `prop` (like `artist` or `tracks`), and a `value`. Complete the function using the rules below to modify the object passed to the function. +The `updateRecords` function takes 4 arguments represented by the following function parameters: -- Your function must always return the entire record collection object. -- If `prop` isn't `tracks` and `value` isn't an empty string, update 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. -- If `prop` is `tracks` and `value` isn't an empty string, add `value` to the end of the album's existing `tracks` array. +- `records` - an object containing several individual albums +- `id` - a number representing a specific album in the `records` object +- `prop` - a string representing the name of the album’s property to update +- `value` - a string containing the information used to update the album’s property + +Complete the function using the rules below to modify the object passed to the function. + +- Your function must always return the entire `records` object. - If `value` is an empty string, delete the given `prop` property from the album. +- If `prop` isn’t `"tracks"` and `value` isn't an empty string, assign the `value` to that album’s `prop`. +- If `prop` is `"tracks"` and `value` isn’t an empty string, add the `value` to the end of the album’s existing `"tracks"` array. +- If the album doesn’t have a `"tracks"` property, create a new array for the album's `"tracks"` property before adding the `value` to it. -**Note:** A copy of the `recordCollection` object is used for the tests. +**Note:** A copy of the `recordCollection` object is used for the tests. You should not directly modify the `recordCollection` object. # --hints--