diff --git a/seed/challenges/01-front-end-development-certification/advanced-bonfires.json b/seed/challenges/01-front-end-development-certification/advanced-bonfires.json
index 3ed7bf6ff8..e1e48a960c 100644
--- a/seed/challenges/01-front-end-development-certification/advanced-bonfires.json
+++ b/seed/challenges/01-front-end-development-certification/advanced-bonfires.json
@@ -78,6 +78,92 @@
"Ricorda di usare Leggi-Cerca-Chiedi se rimani bloccato. Prova a programmare in coppia. Scrivi il codice da te."
]
},
+ {
+ "id": "56533eb9ac21ba0edf2244cf",
+ "title": "Record Collection",
+ "description": [
+ "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 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 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 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.",
+ "Hints
Use bracket 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 Objects Introducing JavaScript Object Notation (JSON) for a refresher."
+ ],
+ "releasedOn": "January 1, 2016",
+ "challengeSeed": [
+ "// Setup",
+ "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\"",
+ " }",
+ "};",
+ "// Keep a copy of the collection for tests",
+ "var collectionCopy = JSON.parse(JSON.stringify(collection));",
+ "",
+ "// Only change code below this line",
+ "function updateRecords(id, prop, value) {",
+ " ",
+ " ",
+ " return collection;",
+ "}",
+ "",
+ "// Alter values below to test your code",
+ "updateRecords(5439, \"artist\", \"ABBA\");",
+ ""
+ ],
+ "tail": [
+ ";(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 === \"\") 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\"
');",
+ "assert(updateRecords(5439, \"tracks\", \"Take a Chance on Me\")[5439][\"tracks\"].pop() === \"Take a Chance on Me\", 'message: After updateRecords(5439, \"tracks\", \"Take a Chance on Me\")
, tracks
should have \"Take a Chance on Me\"
as the last element.');",
+ "updateRecords(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After updateRecords(2548, \"artist\", \"\")
, artist
should not be set');",
+ "assert(updateRecords(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].pop() === \"Addicted to Love\", 'message: After updateRecords(1245, \"tracks\", \"Addicted to Love\")
, tracks
should have \"Addicted to Love\"
as the last element.');",
+ "assert(updateRecords(2468, \"tracks\", \"Free\")[2468][\"tracks\"][0] === \"1999\", 'message: After updateRecords(2468, \"tracks\", \"Free\")
, tracks
should have \"1999\"
as the first element.');",
+ "updateRecords(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After updateRecords(2548, \"tracks\", \"\")
, tracks
should not be set');"
+ ],
+ "type": "bonfire",
+ "challengeType": 5,
+ "titleEs": "Colección de registros",
+ "descriptionEs": [
+ "Se te da un objeto que representa (una pequeña parte de) tu colección de grabaciones. Cada álbum es identificado por un número id único y tiene varias propiedades. No todos los álbumes tienen la información completa.",
+ "Escribe una función que reciba un id
, una propiedad (prop
) y un valor (value
).",
+ "Para el id
dado, en la colección collection
:",
+ "Si el valor value
no está en blanco (value !== \"\"
) y prop
no es \"tracks\"
entonces actualiza o establece el valor de la propiedad prop
.",
+ "Si la propiedad prop
es \"tracks\"
y value
no está en blanco, empuja (push) el valor value
al final del vector tracks
.",
+ "Si el valor value
está en blanco, elimina esa prop
.",
+ "Siempre retorna el objeto collection
entero.",
+ "Nota
No olvides usar notación corchete
cuando accedes a propiedades de objetos con variables."
+ ]
+ },
{
"id": "a3f503de51cf954ede28891d",
"title": "Symmetric Difference",
@@ -524,4 +610,4 @@
]
}
]
-}
+}
\ No newline at end of file
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 e673e9bda0..9f4251b8eb 100644
--- a/seed/challenges/01-front-end-development-certification/basic-javascript.json
+++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json
@@ -4534,92 +4534,6 @@
"Recupera el segundo arbol de la variable myPlants
usando notación punto para objetos y notación corchete para vectores."
]
},
- {
- "id": "56533eb9ac21ba0edf2244cf",
- "title": "Record Collection",
- "description": [
- "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 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 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 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.",
- "Hints
Use bracket 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 Objects Introducing JavaScript Object Notation (JSON) for a refresher."
- ],
- "releasedOn": "January 1, 2016",
- "challengeSeed": [
- "// Setup",
- "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\"",
- " }",
- "};",
- "// Keep a copy of the collection for tests",
- "var collectionCopy = JSON.parse(JSON.stringify(collection));",
- "",
- "// Only change code below this line",
- "function updateRecords(id, prop, value) {",
- " ",
- " ",
- " return collection;",
- "}",
- "",
- "// Alter values below to test your code",
- "updateRecords(5439, \"artist\", \"ABBA\");",
- ""
- ],
- "tail": [
- ";(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 === \"\") 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\"
');",
- "assert(updateRecords(5439, \"tracks\", \"Take a Chance on Me\")[5439][\"tracks\"].pop() === \"Take a Chance on Me\", 'message: After updateRecords(5439, \"tracks\", \"Take a Chance on Me\")
, tracks
should have \"Take a Chance on Me\"
as the last element.');",
- "updateRecords(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After updateRecords(2548, \"artist\", \"\")
, artist
should not be set');",
- "assert(updateRecords(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].pop() === \"Addicted to Love\", 'message: After updateRecords(1245, \"tracks\", \"Addicted to Love\")
, tracks
should have \"Addicted to Love\"
as the last element.');",
- "assert(updateRecords(2468, \"tracks\", \"Free\")[2468][\"tracks\"][0] === \"1999\", 'message: After updateRecords(2468, \"tracks\", \"Free\")
, tracks
should have \"1999\"
as the first element.');",
- "updateRecords(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After updateRecords(2548, \"tracks\", \"\")
, tracks
should not be set');"
- ],
- "type": "checkpoint",
- "challengeType": 1,
- "titleEs": "Colección de registros",
- "descriptionEs": [
- "Se te da un objeto que representa (una pequeña parte de) tu colección de grabaciones. Cada álbum es identificado por un número id único y tiene varias propiedades. No todos los álbumes tienen la información completa.",
- "Escribe una función que reciba un id
, una propiedad (prop
) y un valor (value
).",
- "Para el id
dado, en la colección collection
:",
- "Si el valor value
no está en blanco (value !== \"\"
) y prop
no es \"tracks\"
entonces actualiza o establece el valor de la propiedad prop
.",
- "Si la propiedad prop
es \"tracks\"
y value
no está en blanco, empuja (push) el valor value
al final del vector tracks
.",
- "Si el valor value
está en blanco, elimina esa prop
.",
- "Siempre retorna el objeto collection
entero.",
- "Nota
No olvides usar notación corchete
cuando accedes a propiedades de objetos con variables."
- ]
- },
{
"id": "cf1111c1c11feddfaeb5bdef",
"title": "Iterate with JavaScript For Loops",