You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: coderoad.json
+35-5Lines changed: 35 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -225,25 +225,55 @@
225
225
]
226
226
},
227
227
{
228
-
"description": "First, test out `flatten` on the `flattenedArray`\n @test('1/06/01-concat')\n @open('06-concat.js')\n @action(set(\n```\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n // more on `reduce` coming up next\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n});\n``` \n))",
228
+
"description": "First, test out `flatten` on the `flattenedArray`\n@open('06-concat.js')",
"insert('// use `flatten` to set flattenedArray to [1, 2, 3, 4]\nvar flattenedArray = [[1, 2], [3, 4]];\n')"
238
+
"set('`\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n // more on `reduce` coming up next\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n});')",
239
+
"insert('\n// use `flatten` on `numberedList` to set flattenedArray to [1, 2, 3, 4]\nvar numberedList = [[1, 2], [3, 4]]\nvar flattenedArray;\n')"
231
240
]
232
241
},
233
242
{
234
243
"description": "Map over the course data array, and map over the student array inside of the course data. Set `doubleArray` to return an array of array of objects that looks like this:\n\n```js\n {\n\"title\": \"Relational Databases\",\n\"instructor\": \"Sean Quentin Lewis\",\n\"name\": \"Rebecca Heineman\",\n\"score\": 71,\n\"grade\": \"C\"\n }\n```",
235
244
"tests": [
236
245
"1/06/02-concat"
246
+
],
247
+
"actions": [
248
+
"insert('\n// map over doubleArray twice\nvar doubleArray = courses;\n')"
237
249
]
238
250
},
239
251
{
240
-
"description": "Use `flatten` to put all data into a single array. Set `flattened` to the result.\n @test('1/06/03-concat')"
252
+
"description": "Use `flatten` to put all data into a single array. Set `students` to the result.",
253
+
"tests": [
254
+
"1/06/03-concat"
255
+
],
256
+
"actions": [
257
+
"insert('\n// flatten doubleArray\nvar students = doubleArray;\n')"
258
+
]
241
259
},
242
260
{
243
-
"description": "Use the `suspects` array to `filter` down \"Hack Kerr\"'s data\n @test('1/06/04-concat')"
261
+
"description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data",
262
+
"tests": [
263
+
"1/06/04-concat"
264
+
],
265
+
"actions": [
266
+
"insert('\nvar suspects = [\"Hack Kerr\"];\n\n// filter to data matching `suspects`\nvar suspectData = students;\n')"
267
+
]
244
268
},
245
269
{
246
-
"description": "You just thought of two more suspects: `concat` two more suspects to the suspect list, \"Kevin Mitnick\" & \"Albert Gonzalez\"\n @test('1/06/05-concat')"
270
+
"description": "You just thought of two more suspects! `concat` the new suspects array onto the `suspects` list.",
0 commit comments