Record Collection - Partial

This commit is contained in:
SaintPeter 2015-12-24 15:31:51 -08:00
parent b9436914b3
commit 0c0ab20f53

View File

@ -4153,17 +4153,56 @@
},
{
"id": "56533eb9ac21ba0edf2244cf",
"title": "Checkpoint: Objects",
"title": "Record Collection",
"description": [
"Update a JSON or other Object with a property name and value passed in variables"
"You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unqiue id number and which 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 the <code>property</code> is <code>\"tracks\"</code>, push the <code>value</code> onto the end of the <code>tracks</code> array.",
"If <code>value</code> is non-blank (<code>value !== \"\"</code>), then update or set the <code>value</code> for the <code>prop</code>.",
"If <code>value</code> is blank, delete that <code>prop</code>.",
"Always return the entire collection object."
],
"releasedOn": "11/27/2015",
"tests": [
"assert(1===1, 'message: message here');"
],
"challengeSeed": [
"var collection = {",
" 2548: {",
" album: \"Slippery When Wet\",",
" artist: \"Bon Jovi\",",
" tracks: [ ",
" \"Let It Rock\", ",
" \"You Give Love a Bad Name\" ",
" ]",
" },",
" 2468: {",
" album: \"1999\",",
" artist: \"Prince\",",
" tracks: [ ",
" \"1999\", ",
" \"Little Red Corvette\" ",
" ]",
" },",
" 1245: {",
" artist: \"Robert Palmer\",",
" tracks: [ ]",
" },",
" 5439: {",
" album: \"ABBA Gold\"",
" }",
"};",
"",
"// Only change code below this line",
"function update(id, prop, value) {",
"",
"",
" return collection;",
"}",
"",
"// Alter values below to test your code",
"update(5439, \"artist\", \"ABBA\");",
""
],
"tail": [