Merge pull request #9472 from SMaxOwok/fix/record-collection-desc

Update description of Record Collection code challenge.
pull/9399/merge
Eric Leung 2016-07-01 01:09:58 -07:00 committed by GitHub
commit 53ecda396a
1 changed files with 8 additions and 8 deletions

View File

@ -4517,14 +4517,14 @@
"id": "56533eb9ac21ba0edf2244cf",
"title": "Record Collection",
"description": [
"You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number (its key) and has several properties. Not all albums have complete information.",
"Write a function which takes an <code>id</code>, a property (<code>prop</code>), and a <code>value</code>.",
"For the given <code>id</code> in <code>collection</code>:",
"If <code>prop</code> does not contain the key <code>\"tracks\"</code>, then update or set the <code>value</code> for that incomplete <code>prop</code>.",
"If <code>prop</code> does not contain the key <code>\"tracks\"</code> before you update it, create an empty array before pushing a track to it.",
"If <code>prop</code> does contain the key <code>\"tracks\"</code> and its <code>value</code> is non-blank, then push the <code>value</code> onto the end of its existing <code>tracks</code> array.",
"If <code>value</code> is blank, delete that <code>prop</code>.",
"Always return the entire collection object.",
"You are given a JSON object representing a part of your musical album collection. Each album has several properties and a unique id number as its key. Not all albums have complete information.",
"Write a function which takes an album's <code>id</code> (like <code>2548</code>), a property <code>prop</code> (like <code>\"artist\"</code> or <code>\"tracks\"</code>), and a <code>value</code> (like <code>\"Addicted to Love\"</code>) to modify the data in this collection.",
"If <code>prop</code> isn't <code>\"tracks\"</code> and <code>value</code> isn't blank, update or set the <code>value</code> for that record album's property.",
"Your function must always return the entire collection object.",
"There are several rules for handling incomplete data:",
"If <code>prop</code> is <code>\"tracks\"</code> but the album doesn't have a <code>\"tracks\"</code> property, create an empty array before adding the new value to the album's corresponding property.",
"If <code>prop</code> is <code>\"tracks\"</code> and <code>value</code> isn't blank, push the <code>value</code> onto the end of the album's existing <code>tracks</code> array.",
"If <code>value</code> is blank, delete that property from the album.",
"<strong>Hints</strong><br>Use <code>bracket notation</code> when <a href=\"accessing-objects-properties-with-variables\" target=\"_blank\">accessing object properties with variables</a>.",
"Push is an array method you can read about on <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push\">Mozilla Developer Network</a>.",
"You may refer back to <a href=\"manipulating-complex-objects\">Manipulating Complex Objects</a>Introducing JavaScript Object Notation (JSON)</a> for a refresher."