diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 6b81a00965..3f8638d859 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2052,7 +2052,7 @@ "
reusableFunction
which prints \"Hi World\"
to the dev console.id
(like 2548
), a property prop
(like \"artist\"
or \"tracks\"
), and a value
(like \"Addicted to Love\"
) to modify the data in this collection.",
- "If prop
isn't \"tracks\"
and value
isn't blank, update or set the value
for that record album's property.",
+ "If prop
isn't \"tracks\"
and value
isn't empty (\"\"
), update or set the value
for that record album's property.",
"Your function must always return the entire collection object.",
"There are several rules for handling incomplete data:",
"If prop
is \"tracks\"
but the album doesn't have a \"tracks\"
property, create an empty array before adding the new value to the album's corresponding property.",
- "If prop
is \"tracks\"
and value
isn't blank, push the value
onto the end of the album's existing tracks
array.",
- "If value
is blank, delete that property from the album.",
+ "If prop
is \"tracks\"
and value
isn't empty (\"\"
), push the value
onto the end of the album's existing tracks
array.",
+ "If value
is empty (\"\"
), delete the given prop
property from the album.",
"Hintsbracket notation
when accessing object properties with variables.",
"Push is an array method you can read about on Mozilla Developer Network.",
- "You may refer back to Manipulating Complex ObjectsIntroducing JavaScript Object Notation (JSON) for a refresher."
+ "You may refer back to Manipulating Complex Objects Introducing JavaScript Object Notation (JSON) for a refresher."
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
@@ -4556,8 +4556,8 @@
"",
"// Only change code below this line",
"function updateRecords(id, prop, value) {",
- "",
- "",
+ " ",
+ " ",
" return collection;",
"}",
"",
@@ -4566,10 +4566,10 @@
""
],
"tail": [
- "(function(x) { return \"collection = \\n\" + JSON.stringify(x, '\\n', 2); })(collection);"
+ ";(function(x) { return \"collection = \\n\" + JSON.stringify(x, '\\n', 2); })(collection);"
],
"solutions": [
- "var collection = {\n 2548: {\n album: \"Slippery When Wet\",\n artist: \"Bon Jovi\",\n tracks: [ \n \"Let It Rock\", \n \"You Give Love a Bad Name\" \n ]\n },\n 2468: {\n album: \"1999\",\n artist: \"Prince\",\n tracks: [ \n \"1999\", \n \"Little Red Corvette\" \n ]\n },\n 1245: {\n artist: \"Robert Palmer\",\n tracks: [ ]\n },\n 5439: {\n album: \"ABBA Gold\"\n }\n};\n// Keep a copy of the collection for tests\nvar collectionCopy = JSON.parse(JSON.stringify(collection));\n\n// Only change code below this line\nfunction updateRecords(id, prop, value) {\n if(value !== \"\") {\n if(prop === \"tracks\") {\n collection[id][prop]= collection[id][prop] || [];\n collection[id][prop].push(value);\n } else {\n collection[id][prop] = value;\n }\n } else {\n delete collection[id][prop];\n }\n\n return collection;\n}"
+ "var collection = {\n 2548: {\n album: \"Slippery When Wet\",\n artist: \"Bon Jovi\",\n tracks: [ \n \"Let It Rock\", \n \"You Give Love a Bad Name\" \n ]\n },\n 2468: {\n album: \"1999\",\n artist: \"Prince\",\n tracks: [ \n \"1999\", \n \"Little Red Corvette\" \n ]\n },\n 1245: {\n artist: \"Robert Palmer\",\n tracks: [ ]\n },\n 5439: {\n album: \"ABBA Gold\"\n }\n};\n// Keep a copy of the collection for tests\nvar collectionCopy = JSON.parse(JSON.stringify(collection));\n\n// Only change code below this line\nfunction updateRecords(id, prop, value) {\n if(value === \"\") delete collection[id][prop];\n else if(prop === \"tracks\") {\n collection[id][prop] = collection[id][prop] || [];\n collection[id][prop].push(value);\n } else {\n collection[id][prop] = value;\n }\n \n return collection;\n}"
],
"tests": [
"collection = collectionCopy; assert(updateRecords(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After updateRecords(5439, \"artist\", \"ABBA\")
, artist
should be \"ABBA\"
');",