From a9c5c7d7fe6355865850b291f324a9ef41e0367b Mon Sep 17 00:00:00 2001 From: dimchez Date: Thu, 3 Mar 2016 10:29:01 +0100 Subject: [PATCH 01/46] Updated function name in comments and description Updated changeGrades to changeGrade in comments and description to match actual function name in the code. --- coderoad.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coderoad.json b/coderoad.json index a6b3c07..368b59c 100644 --- a/coderoad.json +++ b/coderoad.json @@ -120,7 +120,7 @@ "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", "tasks": [ { - "description": "Make a function `changeGrades` that takes student data and changes all grades to \"A\"s.", + "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", "tests": [ "1/03/01-map" ], @@ -135,12 +135,12 @@ ] }, { - "description": "Map over the `myData` with the `changeGrades` function. Set `myChanged` to the result.", + "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", "tests": [ "1/03/02-map" ], "actions": [ - "insert('// map over `myData` with the `changeGrades` function\nvar myChanged = myData.map();\n')" + "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map();\n')" ] }, { @@ -486,4 +486,4 @@ ] } ] -} \ No newline at end of file +} From 21023cd16fc6ae547aebf54708f77ff3fb2ec8a0 Mon Sep 17 00:00:00 2001 From: dimchez Date: Thu, 3 Mar 2016 10:33:10 +0100 Subject: [PATCH 02/46] Updated function name Updated function name in comments to match function name in the code --- tutorial/1/03/map.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tutorial/1/03/map.md b/tutorial/1/03/map.md index 25f6fed..7d31a98 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/1/03/map.md @@ -56,7 +56,7 @@ Those D & F grades would look a lot better if they suddenly became A's. Let's go back to before we filtered out the bad grades, and instead change the grades to A's. -+ Make a function `changeGrades` that takes student data and changes all grades to "A"s. ++ Make a function `changeGrade` that takes student data and changes all grades to "A"s. @test('1/03/01-map') @action(open('03-map.js')) @action(set( @@ -72,11 +72,11 @@ function changeGrade() { @hint('match where `student.grade === 'A'`') -+ Map over the `myData` with the `changeGrades` function. Set `myChanged` to the result. ++ Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result. @test('1/03/02-map') @action(insert( ``` -// map over `myData` with the `changeGrades` function +// map over `myData` with the `changeGrade` function var myChanged = myData.map(); ``` )) From 4dcaf381aec55c656daee528c0d61784e3bf9554 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Thu, 3 Mar 2016 08:28:57 -0800 Subject: [PATCH 03/46] onPageComplete statements --- coderoad.json | 26 ++++++++++++-------------- package.json | 6 ++++-- tutorial/1/01/filter.md | 2 +- tutorial/1/02/sort.md | 2 +- tutorial/1/03/map.md | 2 ++ tutorial/1/04/forEach.md | 3 ++- tutorial/1/05/06-find.spec.js | 7 ------- tutorial/1/05/find.md | 3 +-- tutorial/1/06/concat.md | 2 ++ 9 files changed, 25 insertions(+), 28 deletions(-) delete mode 100644 tutorial/1/05/06-find.spec.js diff --git a/coderoad.json b/coderoad.json index 368b59c..8edb111 100644 --- a/coderoad.json +++ b/coderoad.json @@ -66,7 +66,7 @@ ] } ], - "onPageComplete": "In the next unit we'll look at how to `sort` data" + "onPageComplete": "In the next step we'll look at how to `sort` data" }, { "title": "Sort", @@ -113,7 +113,7 @@ ] } ], - "onPageComplete": "In the next unit we'll look at changing data with `map`" + "onPageComplete": "In the next step we'll look at changing data with `map`" }, { "title": "Map", @@ -195,7 +195,8 @@ "return `{ score: student.score, grade: student.grade }`" ] } - ] + ], + "onPageComplete": "In the next step we'll compare `map` with `forEach`" }, { "title": "forEach", @@ -241,7 +242,7 @@ ] }, { - "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.\n\nSomething strange is going on. In the next step we'll try to `find` your data.", + "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.", "tests": [ "1/04/04-forEach" ], @@ -249,7 +250,8 @@ "insert('\nconsole.log(myFixed);\n')" ] } - ] + ], + "onPageComplete": "Something strange is going on. In the next step we'll try to `find` your data." }, { "title": "find", @@ -319,14 +321,9 @@ "hints": [ "call `join` following `unknownStudentNames`" ] - }, - { - "description": "Very strange. In the next step, let's find out who wants revenge, and give it to him!", - "tests": [ - "1/05/06-find" - ] } - ] + ], + "onPageComplete": "Very strange. In the next step, let's find out who wants revenge, and give it to him!" }, { "title": "concat", @@ -389,7 +386,8 @@ "call `suspects.concat()` with `newSuspects`" ] } - ] + ], + "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" }, { "title": "reduce", @@ -486,4 +484,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index 227c9d6..a36c296 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { "name": "coderoad-functional-school", - "version": "0.1.8", + "version": "0.1.9", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", - "contributers": [], + "contributers": [ + "dimchez" + ], "keywords": [ "coderoad", "tutorial", "functional" ], diff --git a/tutorial/1/01/filter.md b/tutorial/1/01/filter.md index 498a5d7..55784ee 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/1/01/filter.md @@ -123,4 +123,4 @@ var myBest = myData.filter(); ``` )) -@onPageComplete('In the next unit we'll look at how to `sort` data') +@onPageComplete('In the next step we'll look at how to `sort` data') diff --git a/tutorial/1/02/sort.md b/tutorial/1/02/sort.md index 77afa28..0b68075 100644 --- a/tutorial/1/02/sort.md +++ b/tutorial/1/02/sort.md @@ -70,4 +70,4 @@ var mySorted = myBest )) @hint('try using `myBest.sort()`') -@onPageComplete('In the next unit we'll look at changing data with `map`') +@onPageComplete('In the next step we'll look at changing data with `map`') diff --git a/tutorial/1/03/map.md b/tutorial/1/03/map.md index 7d31a98..e976a0f 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/1/03/map.md @@ -149,3 +149,5 @@ var scoresAndGrades = myFixed; @hint('use `map` to return only the "score" & "grade" fields') @hint('map with a function with a parameter, call it "student"') @hint('return `{ score: student.score, grade: student.grade }`') + +@onPageComplete('In the next step we'll compare `map` with `forEach`') diff --git a/tutorial/1/04/forEach.md b/tutorial/1/04/forEach.md index ce919dc..3a190ea 100644 --- a/tutorial/1/04/forEach.md +++ b/tutorial/1/04/forEach.md @@ -150,7 +150,6 @@ myFixed = students This is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected. -Something strange is going on. In the next step we'll try to `find` your data. @test('1/04/04-forEach') @action(insert( ``` @@ -158,3 +157,5 @@ Something strange is going on. In the next step we'll try to `find` your data. console.log(myFixed); ``` )) + +@onPageComplete('Something strange is going on. In the next step we'll try to `find` your data.') diff --git a/tutorial/1/05/06-find.spec.js b/tutorial/1/05/06-find.spec.js deleted file mode 100644 index 811eef3..0000000 --- a/tutorial/1/05/06-find.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('06 complete', function() { - - it('should pass', function() { - expect(true).to.be.true; - }); - -}); diff --git a/tutorial/1/05/find.md b/tutorial/1/05/find.md index 84c83bc..f1a43b1 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/1/05/find.md @@ -96,5 +96,4 @@ console.log(decodedName); )) @hint('call `join` following `unknownStudentNames`') -+ Very strange. In the next step, let's find out who wants revenge, and give it to him! -@test('1/05/06-find') +@onPageComplete('Very strange. In the next step, let's find out who wants revenge, and give it to him!') diff --git a/tutorial/1/06/concat.md b/tutorial/1/06/concat.md index edf0244..b955e5f 100644 --- a/tutorial/1/06/concat.md +++ b/tutorial/1/06/concat.md @@ -183,3 +183,5 @@ var newSuspects = ['Albert Gonzalez', 'Kevin Mitnick']; `concat` the `newSuspects` onto the `suspects` list. @test('1/06/05-concat') @hint('call `suspects.concat()` with `newSuspects`') + +@onPageComplete('In the next step, we'll look at using one of the most powerful methods: `reduce`') From ca04355f1fc9c1d920a0d64438b27dabebe555b3 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 7 Mar 2016 09:29:45 -0800 Subject: [PATCH 04/46] add cursor position (::>) --- coderoad.json | 54 ++++++++++++++++++++-------------------- package.json | 2 +- tutorial/1/01/filter.md | 9 +++---- tutorial/1/02/sort.md | 4 +-- tutorial/1/03/map.md | 8 +++--- tutorial/1/04/forEach.md | 6 ++--- tutorial/1/05/find.md | 10 ++++---- tutorial/1/06/concat.md | 8 +++--- tutorial/1/07/reduce.md | 10 ++++---- 9 files changed, 55 insertions(+), 56 deletions(-) diff --git a/coderoad.json b/coderoad.json index 8edb111..19e9758 100644 --- a/coderoad.json +++ b/coderoad.json @@ -20,7 +20,7 @@ "actions": [ "open('01-filter.js')", "set('/**\n * Data is set as a global. Example:\n * [{\n * \"title\": \"Relational Databases\",\n * \"instructor\": \"Sean Quentin Lewis\",\n * \"name\": \"Ada Lovelace\",\n * \"score\": 91,\n * \"grade\": \"A\"\n * },\n * ...\n * ]\n*/\n')", - "insert('function isAda() {\n // write condition here\n // return true if student name\n // matches \"Ada Lovelace\"\n\n}\n')" + "insert('function isAda(::>) {\n // return true if student name\n // matches \"Ada Lovelace\"\n\n}\n')" ], "hints": [ "Some tasks have hints", @@ -35,7 +35,7 @@ "1/01/02-filter" ], "actions": [ - "insert('// call filter condition here\nvar myData = data.filter();\n')" + "insert('// call filter condition here\nvar myData = data.filter(::>);\n')" ], "hints": [ "Add a function to the `filter` call: `Array.filter(function() {})`", @@ -48,7 +48,7 @@ "1/01/03-filter" ], "actions": [ - "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n\n}\n')" + "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" ], "hints": [ "match for `student.grade` that isn't \"D\" or \"F\"", @@ -62,7 +62,7 @@ "1/01/04-filter" ], "actions": [ - "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter();\n\n')" + "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter(::>);\n\n')" ] } ], @@ -79,7 +79,7 @@ ], "actions": [ "open('02-sort.js')", - "set('function compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + "set('function compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" ] }, { @@ -106,7 +106,7 @@ "1/02/04-sort" ], "actions": [ - "insert('// use the compare function to sort myBest\nvar mySorted = myBest\n')" + "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" ], "hints": [ "try using `myBest.sort()`" @@ -126,7 +126,7 @@ ], "actions": [ "open('03-map.js')", - "set('// change any `student.grade`'s into an 'A'\nfunction changeGrade() {\n\n}\n')" + "set('// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" ], "hints": [ "give `changeGrade` a parameter, call it \"student\"", @@ -140,7 +140,7 @@ "1/03/02-map" ], "actions": [ - "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map();\n')" + "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" ] }, { @@ -149,7 +149,7 @@ "1/03/03-map" ], "actions": [ - "insert('\nfunction increaseScore() {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" + "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" ], "hints": [ "give `increaseScore` a parameter, call it \"student\"", @@ -187,7 +187,7 @@ "1/03/06-map" ], "actions": [ - "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed;\n')" + "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" ], "hints": [ "use `map` to return only the \"score\" & \"grade\" fields", @@ -209,7 +209,7 @@ ], "actions": [ "open('04-forEach.js')", - "set('function logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach();\n')" + "set('function logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" ], "hints": [ "call `forEach` with `logCourse`" @@ -221,7 +221,7 @@ "1/04/02-forEach" ], "actions": [ - "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" + "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course::>) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" ], "hints": [ "Array methods can take more than one parameter", @@ -234,7 +234,7 @@ "1/04/03-forEach" ], "actions": [ - "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" + "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index::>) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" ], "hints": [ "Array methods can take more than one parameter", @@ -264,7 +264,7 @@ ], "actions": [ "open('05-find.js')", - "set('// filter for the student title matches \"Web Security\"\nvar myClass = students.filter();\n')" + "set('// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" ], "hints": [ "create a `filter` function", @@ -278,7 +278,7 @@ ], "actions": [ "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", - "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList() {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" + "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" ], "hints": [ "use `indexOf` to find what doesn't match", @@ -292,7 +292,7 @@ "1/05/03-find" ], "actions": [ - "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter();\n')" + "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" ], "hints": [ "consider reusing a function" @@ -304,7 +304,7 @@ "1/05/04-find" ], "actions": [ - "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map();\n')" + "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" ], "hints": [ "use `map` to return only the `student.name`" @@ -316,7 +316,7 @@ "1/05/05-find" ], "actions": [ - "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames;\nconsole.log(decodedName);\n')" + "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" ], "hints": [ "call `join` following `unknownStudentNames`" @@ -337,7 +337,7 @@ "actions": [ "open('06-concat.js')", "set('// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", - "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList;\n')" + "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" ], "hints": [ "call `.flatten()` on `numberedList`" @@ -349,7 +349,7 @@ "1/06/02-concat" ], "actions": [ - "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: '',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" + "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" ], "hints": [ "pair `course.title`", @@ -362,7 +362,7 @@ "1/06/03-concat" ], "actions": [ - "insert('// `flatten` doubleArray\nvar students = doubleArray;\n')" + "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" ], "hints": [ "call `.flatten()` on `doubleArray`" @@ -374,7 +374,7 @@ "1/06/04-concat" ], "actions": [ - "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students;\n')" + "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" ] }, { @@ -400,7 +400,7 @@ ], "actions": [ "open('07-reduce.js')", - "set('var practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce();\n')" + "set('var practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" ], "hints": [ "with only numbers, the initialValue defaults to 0", @@ -413,7 +413,7 @@ "1/07/02-reduce" ], "actions": [ - "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" + "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" ], "hints": [ "set the initialValue to 0", @@ -427,7 +427,7 @@ "1/07/03-reduce" ], "actions": [ - "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" + "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" ], "hints": [ "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", @@ -442,7 +442,7 @@ "1/07/04-reduce" ], "actions": [ - "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce();\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" + "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" ], "hints": [ "You may want to use a second param: `index`", @@ -456,7 +456,7 @@ "1/07/05-reduce" ], "actions": [ - "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function() {}, []);\n')" + "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" ], "hints": [ "use `.join(', ')`" diff --git a/package.json b/package.json index a36c296..e9e0e9c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.1.9", + "version": "0.1.10", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/1/01/filter.md b/tutorial/1/01/filter.md index 55784ee..795b384 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/1/01/filter.md @@ -72,8 +72,7 @@ console.log(data[0]); )) @action(insert( ``` -function isAda() { - // write condition here +function isAda(::>) { // return true if student name // matches "Ada Lovelace" @@ -90,7 +89,7 @@ function isAda() { @action(insert( ``` // call filter condition here -var myData = data.filter(); +var myData = data.filter(::>); ``` )) @hint('Add a function to the `filter` call: `Array.filter(function() {})`') @@ -104,7 +103,7 @@ var myData = data.filter(); // return true if student.grade is not a "D" or "F" function isGoodGrade(student) { - + ::> } ``` )) @@ -118,7 +117,7 @@ function isGoodGrade(student) { @action(insert( ``` // filter out "D"'s and "F"'s here -var myBest = myData.filter(); +var myBest = myData.filter(::>); ``` )) diff --git a/tutorial/1/02/sort.md b/tutorial/1/02/sort.md index 0b68075..ecd91ed 100644 --- a/tutorial/1/02/sort.md +++ b/tutorial/1/02/sort.md @@ -41,7 +41,7 @@ function compareScore(a, b) { switch (true) { case b.score > a.score: // it should return 1 if b's score is more than a's - return + return ::> case 'set condition here': // it should return -1 if b's score is less than a's @@ -65,7 +65,7 @@ function compareScore(a, b) { @action(insert( ``` // use the compare function to sort myBest -var mySorted = myBest +var mySorted = myBest::> ``` )) @hint('try using `myBest.sort()`') diff --git a/tutorial/1/03/map.md b/tutorial/1/03/map.md index e976a0f..8b8fe3b 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/1/03/map.md @@ -62,7 +62,7 @@ Let's go back to before we filtered out the bad grades, and instead change the g @action(set( ``` // change any `student.grade`'s into an 'A' -function changeGrade() { +function changeGrade(::>) { } ``` @@ -77,7 +77,7 @@ function changeGrade() { @action(insert( ``` // map over `myData` with the `changeGrade` function -var myChanged = myData.map(); +var myChanged = myData.map(::>); ``` )) @@ -89,7 +89,7 @@ Let's go back to `myData` and instead increment each score by 12 points. @action(insert( ``` -function increaseScore() { +function increaseScore(::>) { } @@ -143,7 +143,7 @@ var myFixed = mySlightlyChanged; // set `scoresAndGrades` to an array of scores and grades // it should return an array of objects like this: {score: 75, grade: 'C'} -var scoresAndGrades = myFixed; +var scoresAndGrades = myFixed::> ``` )) @hint('use `map` to return only the "score" & "grade" fields') diff --git a/tutorial/1/04/forEach.md b/tutorial/1/04/forEach.md index 3a190ea..d6ea2c8 100644 --- a/tutorial/1/04/forEach.md +++ b/tutorial/1/04/forEach.md @@ -96,7 +96,7 @@ function logCourse(course) { } // log your grades to the console -myFixed.forEach(); +myFixed.forEach(::>); ``` )) @hint('call `forEach` with `logCourse`') @@ -107,7 +107,7 @@ myFixed.forEach(); ``` // add a second param called 'index' to the function -function logCourseWithIndex(course) { +function logCourseWithIndex(course::>) { console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`); } @@ -124,7 +124,7 @@ myFixed.forEach(logCourseWithIndex); ``` // add a third param called 'array' to the function -function logCourseWithIndexAndArray(course, index) { +function logCourseWithIndexAndArray(course, index::>) { console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`); } diff --git a/tutorial/1/05/find.md b/tutorial/1/05/find.md index f1a43b1..318f897 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/1/05/find.md @@ -31,7 +31,7 @@ Find is great for performantly matching unique values in data, such as an "id", @action(set( ``` // filter for the student title matches "Web Security" -var myClass = students.filter(); +var myClass = students.filter(::>); ``` )) @hint('create a `filter` function') @@ -50,7 +50,7 @@ var otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berr ``` // search for a student with a name // not matching students in `otherStudents` -function notInList() { +function notInList(::>) { } @@ -68,7 +68,7 @@ var unknownStudent = myClass.find(); ``` // filter using `notInList` -var unknownStudentList = students.filter(); +var unknownStudentList = students.filter(::>); ``` )) @hint('consider reusing a function') @@ -79,7 +79,7 @@ var unknownStudentList = students.filter(); ``` // list only student names -var unknownStudentNames = unknownStudentList.map(); +var unknownStudentNames = unknownStudentList.map(::>); ``` )) @hint('use `map` to return only the `student.name`') @@ -90,7 +90,7 @@ var unknownStudentNames = unknownStudentList.map(); ``` // use `.join('')` to join the array of strings -var decodedName = unknownStudentNames; +var decodedName = unknownStudentNames::>; console.log(decodedName); ``` )) diff --git a/tutorial/1/06/concat.md b/tutorial/1/06/concat.md index b955e5f..2875f98 100644 --- a/tutorial/1/06/concat.md +++ b/tutorial/1/06/concat.md @@ -114,7 +114,7 @@ Array.prototype.flatten = function() { var numberedList = [[1, 2], [3, 4]]; // use `flatten` on `numberedList` -var flattenedArray = numberedList; +var flattenedArray = numberedList::>; ``` )) @hint('call `.flatten()` on `numberedList`') @@ -138,7 +138,7 @@ var doubleArray = courses.map(function(course) { return course.students.map(function(student) { return { // fill in the fields - title: '', + title: ::>'', instructor: '', name: '', score: '', @@ -157,7 +157,7 @@ var doubleArray = courses.map(function(course) { @action(insert( ``` // `flatten` doubleArray -var students = doubleArray; +var students = doubleArray::>; ``` )) @hint('call `.flatten()` on `doubleArray`') @@ -170,7 +170,7 @@ var students = doubleArray; var suspects = ["Hack Kerr"]; // filter to data matching `suspects` -var suspectData = students; +var suspectData = students::>; ``` )) diff --git a/tutorial/1/07/reduce.md b/tutorial/1/07/reduce.md index 0de9f43..2360cbc 100644 --- a/tutorial/1/07/reduce.md +++ b/tutorial/1/07/reduce.md @@ -60,7 +60,7 @@ function add(a, b) { } // total the numbers using a reduce function -var total = practice.reduce(); +var total = practice.reduce(::>); ``` )) @hint('with only numbers, the initialValue defaults to 0') @@ -75,7 +75,7 @@ var total = practice.reduce(); var averages = courses.map(function(course) { var sum = course.students.reduce(function(total, student) { - + ::> }); return Math.round(sum / course.students.length, 0); @@ -100,7 +100,7 @@ var suspectScores = suspectData.reduce(function(total, next) { }); if (index < 0) { total.push({ - + ::> }); } else { @@ -131,7 +131,7 @@ var suspectScores = suspectData.reduce(function(total, next) { var suspectStats = suspectScores.map(function(suspect) { // calculate the total difference in scores from the averages - var difference = suspect.scores.reduce(); + var difference = suspect.scores.reduce(::>); return { name: suspect.name, @@ -158,7 +158,7 @@ function isCheater(suspect) { } // reduce down to a string of likely suspects -var likelySuspects = suspectStats.reduce(function() {}, []); +var likelySuspects = suspectStats.reduce(function(::>) {}, []); ``` )) @hint('use `.join(', ')`') From b8bfeb4cfeed4f01520349bc3325a8b4bf64e062 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 7 Mar 2016 09:32:11 -0800 Subject: [PATCH 05/46] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 499e958..a56626a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,5 +3,7 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.7] - 2016-02-26 -### Added - Hints for steps 1-7 + +##[0.1.10] - 2016-03-07 +- Cursor position added (`::>`) From 28ebbc010c4526d71212a49d160567e59fd6649b Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 7 Mar 2016 09:33:21 -0800 Subject: [PATCH 06/46] changelog update --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a56626a..e29673b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,5 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.7] - 2016-02-26 - Hints for steps 1-7 +##[0.1.9] - 2016-03-04 +- `@onPageComplete` messages + ##[0.1.10] - 2016-03-07 - Cursor position added (`::>`) From 44efb350265feed3cafb2e2f1f6b649f7a147d38 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Thu, 10 Mar 2016 16:20:56 -0800 Subject: [PATCH 07/46] add start chapter, various fixes --- README.md | 28 ++++++++++++++ coderoad.json | 68 ++++++++++++++++++++++++++++------ tutorial/1/00/01-setup.spec.js | 41 ++++++++++++++++++++ tutorial/1/00/02-setup.spec.js | 16 ++++++++ tutorial/1/00/03-setup.spec.js | 11 ++++++ tutorial/1/00/setup.md | 65 ++++++++++++++++++++++++++++++++ tutorial/1/01/filter.md | 27 +++----------- tutorial/1/02/sort.md | 2 + tutorial/1/03/map.md | 2 + tutorial/1/04/forEach.md | 2 + tutorial/1/05/find.md | 2 + tutorial/1/06/concat.md | 2 + tutorial/1/07/reduce.md | 2 + tutorial/tutorial.md | 1 + 14 files changed, 237 insertions(+), 32 deletions(-) create mode 100644 tutorial/1/00/01-setup.spec.js create mode 100644 tutorial/1/00/02-setup.spec.js create mode 100644 tutorial/1/00/03-setup.spec.js create mode 100644 tutorial/1/00/setup.md diff --git a/README.md b/README.md index 5fca5d3..eb7d0ad 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,34 @@ Using common built-in Javascript array methods such as `map` & `reduce`. By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. +##### Start + +Understanding the Data Set + +Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. + +```json +var data = [ + { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }, + ... +] +``` + +Here we have an array of "student" objects. To get the first item in the array, you can use the array index. Array indexes start at 0. + +```js +console.log( + 'first instructor', data[0].instructor +); +// first instructor Sean Quentin Lewis +``` + ##### Filter Array -> Array of items that match a condition diff --git a/coderoad.json b/coderoad.json index 19e9758..2818266 100644 --- a/coderoad.json +++ b/coderoad.json @@ -8,6 +8,54 @@ "title": "Array Methods", "description": "Using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.", "pages": [ + { + "title": "Start", + "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar data = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', data[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", + "tasks": [ + { + "description": "Set `first` to the first item in the `data` array.", + "tests": [ + "1/00/01-setup" + ], + "actions": [ + "open('00-setup.js')", + "set('// Welcome to CodeRoad!\n\nvar first = ::>\n')" + ], + "hints": [ + "Get the first item in data using the array index", + "Access the title of `data[0]`" + ] + }, + { + "description": "Set `myName` to the \"name\" of the first student in the list.", + "tests": [ + "1/00/02-setup" + ], + "actions": [ + "insert('var myName= ::>\n')" + ], + "hints": [ + "Get the first \"name\" in the data using the array index", + "Access the \"name\" of `first`", + "Try `first.name`" + ] + }, + { + "description": "Log your name to the console.", + "tests": [ + "1/00/03-setup" + ], + "actions": [ + "insert('\nconsole.log(::>);\n')" + ], + "hints": [ + "Use `console.log`", + "Use `console.log(myName)`" + ] + } + ], + "onPageComplete": "Now we're ready to get started with `filter`ing our data.\\n\\n" + }, { "title": "Filter", "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(data[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", @@ -19,23 +67,21 @@ ], "actions": [ "open('01-filter.js')", - "set('/**\n * Data is set as a global. Example:\n * [{\n * \"title\": \"Relational Databases\",\n * \"instructor\": \"Sean Quentin Lewis\",\n * \"name\": \"Ada Lovelace\",\n * \"score\": 91,\n * \"grade\": \"A\"\n * },\n * ...\n * ]\n*/\n')", - "insert('function isAda(::>) {\n // return true if student name\n // matches \"Ada Lovelace\"\n\n}\n')" + "insert('// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" ], "hints": [ "Some tasks have hints", - "Pass in a parameter to `isAda`, let's call it \"student\"", "Check if `student.name` matches \"Ada Lovelace\"", "Use `===` to check equality" ] }, { - "description": "Set `var myData` equal to data matching your name, \"Ada Lovelace\".", + "description": "Set `var myData` to filter with the `isAda` function.", "tests": [ "1/01/02-filter" ], "actions": [ - "insert('// call filter condition here\nvar myData = data.filter(::>);\n')" + "insert('// run the function name in filter\nvar myData = data.filter(::>);\n')" ], "hints": [ "Add a function to the `filter` call: `Array.filter(function() {})`", @@ -79,7 +125,7 @@ ], "actions": [ "open('02-sort.js')", - "set('function compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + "set('// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" ] }, { @@ -126,7 +172,7 @@ ], "actions": [ "open('03-map.js')", - "set('// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" + "set('// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" ], "hints": [ "give `changeGrade` a parameter, call it \"student\"", @@ -209,7 +255,7 @@ ], "actions": [ "open('04-forEach.js')", - "set('function logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" + "set('// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" ], "hints": [ "call `forEach` with `logCourse`" @@ -264,7 +310,7 @@ ], "actions": [ "open('05-find.js')", - "set('// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" + "set('// Array.find(fn)\n\n// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" ], "hints": [ "create a `filter` function", @@ -336,7 +382,7 @@ ], "actions": [ "open('06-concat.js')", - "set('// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", + "set('// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" ], "hints": [ @@ -400,7 +446,7 @@ ], "actions": [ "open('07-reduce.js')", - "set('var practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" + "set('// Array.reduce(fn(a, b), initialValue)\n\nvar practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" ], "hints": [ "with only numbers, the initialValue defaults to 0", diff --git a/tutorial/1/00/01-setup.spec.js b/tutorial/1/00/01-setup.spec.js new file mode 100644 index 0000000..1c0ea51 --- /dev/null +++ b/tutorial/1/00/01-setup.spec.js @@ -0,0 +1,41 @@ +"use strict"; +var chai = require('chai'); +var spies = require('chai-spies'); +var expect = chai.expect; +chai.use(spies); + +var loadJS = require('./common/loadJS').default; + +if (!global.data) { + global.data = JSON.parse(JSON.stringify(require('./data/students.json'))); +} + +var spy = chai.spy.on(console, 'log'); +loadJS('00-setup.js'); + +describe('01 first', function () { + + it('should exist', function () { + expect(first).to.be.defined; + }); + + it('should be an object', function () { + expect(first).to.be.an('object'); + }); + + it('should take have property title', function () { + expect(first).to.have.property('title'); + }); + + it('should have the correct value', function () { + var result = { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }; + expect(first).to.deep.equal(result); + }); + +}); diff --git a/tutorial/1/00/02-setup.spec.js b/tutorial/1/00/02-setup.spec.js new file mode 100644 index 0000000..48b29d0 --- /dev/null +++ b/tutorial/1/00/02-setup.spec.js @@ -0,0 +1,16 @@ +describe('02 myName', function () { + + it('should exist', function () { + expect(myName).to.be.defined; + }); + + it('should be a string', function () { + expect(myName).to.be.a('string'); + }); + + it('should have the correct value', function () { + var result = 'Ada Lovelace'; + expect(myName).to.deep.equal(result); + }); + +}); diff --git a/tutorial/1/00/03-setup.spec.js b/tutorial/1/00/03-setup.spec.js new file mode 100644 index 0000000..3b29517 --- /dev/null +++ b/tutorial/1/00/03-setup.spec.js @@ -0,0 +1,11 @@ +describe('03 console.log', function() { + + it('should use `console.log` to log the name', function() { + expect(spy).to.have.been.called(); + }) + + it('should log `myName` to the console', function() { + expect(spy).to.have.been.called.with('Ada Lovelace'); + }); + +}); diff --git a/tutorial/1/00/setup.md b/tutorial/1/00/setup.md new file mode 100644 index 0000000..166acf6 --- /dev/null +++ b/tutorial/1/00/setup.md @@ -0,0 +1,65 @@ +### Start +Understanding the Data Set + +Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. + +```json +var data = [ + { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }, + ... +] +``` + +Here we have an array of "student" objects. To get the first item in the array, you can use the array index. Array indexes start at 0. + +```js +console.log( + 'first instructor', data[0].instructor +); +// first instructor Sean Quentin Lewis +``` + ++ Set `first` to the first item in the `data` array. +@test('1/00/01-setup') +@action(open('00-setup.js')) +@action(set( +``` +// Welcome to CodeRoad! + +var first = ::> +``` +)) +@hint('Get the first item in data using the array index') +@hint('Access the title of `data[0]`') + + ++ Set `myName` to the "name" of the first student in the list. +@test('1/00/02-setup') +@action(insert( +``` +var myName= ::> +``` +)) +@hint('Get the first "name" in the data using the array index') +@hint('Access the "name" of `first`') +@hint('Try `first.name`') + ++ Log your name to the console. +@test('1/00/03-setup') +@action(insert( +``` + +console.log(::>); +``` +)) +@hint('Use `console.log`') +@hint('Use `console.log(myName)`') + + +@onPageComplete('Now we're ready to get started with `filter`ing our data.') diff --git a/tutorial/1/01/filter.md b/tutorial/1/01/filter.md index 795b384..7d35970 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/1/01/filter.md @@ -54,41 +54,26 @@ console.log(data[0]); + Write a filter condition function called `isAda` that returns true only if the name matches your name: "Ada Lovelace". @test('1/01/01-filter') @action(open('01-filter.js')) -@action(set( -``` -/** - * Data is set as a global. Example: - * [{ - * "title": "Relational Databases", - * "instructor": "Sean Quentin Lewis", - * "name": "Ada Lovelace", - * "score": 91, - * "grade": "A" - * }, - * ... - * ] -*/ -``` -)) @action(insert( ``` -function isAda(::>) { +// Array.filter(fn) + +function isAda(student) { // return true if student name // matches "Ada Lovelace" - + ::> } ``` )) @hint('Some tasks have hints') -@hint('Pass in a parameter to `isAda`, let's call it "student"') @hint('Check if `student.name` matches "Ada Lovelace"') @hint('Use `===` to check equality') -+ Set `var myData` equal to data matching your name, "Ada Lovelace". ++ Set `var myData` to filter with the `isAda` function. @test('1/01/02-filter') @action(insert( ``` -// call filter condition here +// run the function name in filter var myData = data.filter(::>); ``` )) diff --git a/tutorial/1/02/sort.md b/tutorial/1/02/sort.md index ecd91ed..3c4ede4 100644 --- a/tutorial/1/02/sort.md +++ b/tutorial/1/02/sort.md @@ -37,6 +37,8 @@ First you'll need to write a sort condition function called `compareScore`. @action(open('02-sort.js')) @action(set( ``` +// Array.sort(fn) + function compareScore(a, b) { switch (true) { case b.score > a.score: diff --git a/tutorial/1/03/map.md b/tutorial/1/03/map.md index 8b8fe3b..869461d 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/1/03/map.md @@ -61,6 +61,8 @@ Let's go back to before we filtered out the bad grades, and instead change the g @action(open('03-map.js')) @action(set( ``` +// Array.map(fn) + // change any `student.grade`'s into an 'A' function changeGrade(::>) { diff --git a/tutorial/1/04/forEach.md b/tutorial/1/04/forEach.md index d6ea2c8..761accf 100644 --- a/tutorial/1/04/forEach.md +++ b/tutorial/1/04/forEach.md @@ -91,6 +91,8 @@ Now that we see how `forEach` works, let's use it to make calls to the `console` @action(open('04-forEach.js')) @action(set( ``` +// Array.forEach(fn) + function logCourse(course) { console.log(`${course.grade} ${course.score} ${course.title}`); } diff --git a/tutorial/1/05/find.md b/tutorial/1/05/find.md index 318f897..62e69f9 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/1/05/find.md @@ -30,6 +30,8 @@ Find is great for performantly matching unique values in data, such as an "id", @action(open('05-find.js')) @action(set( ``` +// Array.find(fn) + // filter for the student title matches "Web Security" var myClass = students.filter(::>); ``` diff --git a/tutorial/1/06/concat.md b/tutorial/1/06/concat.md index 2875f98..31a61c3 100644 --- a/tutorial/1/06/concat.md +++ b/tutorial/1/06/concat.md @@ -100,6 +100,8 @@ We'll test out flatten, then re-create our student array of data from the origin @action(open('06-concat.js')) @action(set( ``` +// Array.concat(any) + // Array.prototype can be used to create new Array methods Array.prototype.flatten = function() { return this.reduce(function(a, b) { diff --git a/tutorial/1/07/reduce.md b/tutorial/1/07/reduce.md index 2360cbc..5433dfb 100644 --- a/tutorial/1/07/reduce.md +++ b/tutorial/1/07/reduce.md @@ -53,6 +53,8 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp @action(open('07-reduce.js')) @action(set( ``` +// Array.reduce(fn(a, b), initialValue) + var practice = [1, 1, 2, 3, 5, 8, 13, 21]; function add(a, b) { diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index 11a47ab..921205c 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -10,6 +10,7 @@ Using common built-in Javascript array methods such as `map` & `reduce`. By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. +@import('./tutorial/1/00/setup') @import('./tutorial/1/01/filter') @import('./tutorial/1/02/sort') @import('./tutorial/1/03/map') From 79f17d898e8538333aa4c622cda17e0fb3ea1a6a Mon Sep 17 00:00:00 2001 From: ShMcK Date: Thu, 10 Mar 2016 16:21:14 -0800 Subject: [PATCH 08/46] increment version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9e0e9c..93511ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.1.10", + "version": "0.1.11", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ From 1c95db06409ca708de8571452ca5a6bad45e13bc Mon Sep 17 00:00:00 2001 From: ShMcK Date: Sun, 13 Mar 2016 11:33:28 -0700 Subject: [PATCH 09/46] first tutorial version to work on windows --- coderoad.json | 2 +- package.json | 2 +- tutorial/1/00/01-setup.spec.js | 6 ++++-- tutorial/1/01/01-filter.spec.js | 5 +++-- tutorial/1/02/01-sort.spec.js | 5 +++-- tutorial/1/03/01-map.spec.js | 5 +++-- tutorial/1/04/01-forEach.spec.js | 4 ++-- tutorial/1/05/01-find.spec.js | 5 +++-- tutorial/1/06/01-concat.spec.js | 5 +++-- tutorial/1/07/01-reduce.spec.js | 7 ++++--- tutorial/{common => }/loadJS.js | 0 11 files changed, 27 insertions(+), 19 deletions(-) rename tutorial/{common => }/loadJS.js (100%) diff --git a/coderoad.json b/coderoad.json index 2818266..e725dad 100644 --- a/coderoad.json +++ b/coderoad.json @@ -54,7 +54,7 @@ ] } ], - "onPageComplete": "Now we're ready to get started with `filter`ing our data.\\n\\n" + "onPageComplete": "Now we're ready to get started with `filter`ing our data." }, { "title": "Filter", diff --git a/package.json b/package.json index 93511ec..afe335b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.1.11", + "version": "0.2.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/1/00/01-setup.spec.js b/tutorial/1/00/01-setup.spec.js index 1c0ea51..6704064 100644 --- a/tutorial/1/00/01-setup.spec.js +++ b/tutorial/1/00/01-setup.spec.js @@ -2,12 +2,14 @@ var chai = require('chai'); var spies = require('chai-spies'); var expect = chai.expect; +var path = require('path'); chai.use(spies); -var loadJS = require('./common/loadJS').default; +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.data) { - global.data = JSON.parse(JSON.stringify(require('./data/students.json'))); + let data = require(path.join(process.env.TUTORIAL_DIR, 'data', 'students.json')); + global.data = JSON.parse(JSON.stringify(data)); } var spy = chai.spy.on(console, 'log'); diff --git a/tutorial/1/01/01-filter.spec.js b/tutorial/1/01/01-filter.spec.js index 951b8a4..19fd08b 100644 --- a/tutorial/1/01/01-filter.spec.js +++ b/tutorial/1/01/01-filter.spec.js @@ -1,9 +1,10 @@ "use strict"; var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; +var path = require('path'); +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.data) { - global.data = JSON.parse(JSON.stringify(require('./data/students.json'))); + global.data = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'students.json')))); } loadJS('01-filter.js'); diff --git a/tutorial/1/02/01-sort.spec.js b/tutorial/1/02/01-sort.spec.js index f27dd82..edeb44a 100644 --- a/tutorial/1/02/01-sort.spec.js +++ b/tutorial/1/02/01-sort.spec.js @@ -1,7 +1,8 @@ var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; +var path = require('path'); +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.myBest) { - global.myBest = JSON.parse(JSON.stringify(require('./1/02/myBest.json'))); + global.myBest = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '02', 'myBest.json')))); } loadJS('02-sort.js'); diff --git a/tutorial/1/03/01-map.spec.js b/tutorial/1/03/01-map.spec.js index 66c2eeb..4e4ec47 100644 --- a/tutorial/1/03/01-map.spec.js +++ b/tutorial/1/03/01-map.spec.js @@ -1,7 +1,8 @@ var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; +var path = require('path'); +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.myData) { - global.myData = JSON.parse(JSON.stringify(require('./1/03/myData.json'))); + global.myData = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '03', 'myData.json')))); } loadJS('03-map.js') diff --git a/tutorial/1/04/01-forEach.spec.js b/tutorial/1/04/01-forEach.spec.js index 9eb73c5..e7f932c 100644 --- a/tutorial/1/04/01-forEach.spec.js +++ b/tutorial/1/04/01-forEach.spec.js @@ -4,9 +4,9 @@ var spies = require('chai-spies'); var expect = chai.expect; chai.use(spies); var path = require('path'); -var loadJS = require('./common/loadJS').default; +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -global.myFixed = JSON.parse(JSON.stringify(require('./1/04/myFixed.json'))); +global.myFixed = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '04', 'myFixed.json')))); if (process.env.TASK_POSITION === '4') { global.myFixed = []; diff --git a/tutorial/1/05/01-find.spec.js b/tutorial/1/05/01-find.spec.js index 4c5036b..6a6b9f2 100644 --- a/tutorial/1/05/01-find.spec.js +++ b/tutorial/1/05/01-find.spec.js @@ -1,10 +1,11 @@ 'use strict'; var expect = require('chai').expect; var spies = require('chai-spies'); -var loadJS = require('./common/loadJS').default; +var path = require('path'); +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.students) { - global.students = JSON.parse(JSON.stringify(require('./data/students2.json'))); + global.students = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'students2.json')))); } loadJS('05-find.js'); diff --git a/tutorial/1/06/01-concat.spec.js b/tutorial/1/06/01-concat.spec.js index c6ce5c4..7540261 100644 --- a/tutorial/1/06/01-concat.spec.js +++ b/tutorial/1/06/01-concat.spec.js @@ -1,9 +1,10 @@ 'use strict'; var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; +var path = require('path'); +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.courses) { - global.courses = JSON.parse(JSON.stringify(require('./data/courses2.json'))); + global.courses = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'courses2.json')))); } loadJS('06-concat.js'); diff --git a/tutorial/1/07/01-reduce.spec.js b/tutorial/1/07/01-reduce.spec.js index e32e40b..dfdc72d 100644 --- a/tutorial/1/07/01-reduce.spec.js +++ b/tutorial/1/07/01-reduce.spec.js @@ -1,10 +1,11 @@ "use strict"; var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; +var path = require('path'); +var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; if (!global.courses) { - global.courses = JSON.parse(JSON.stringify(require('./data/courses2.json'))); - global.suspectData = JSON.parse(JSON.stringify(require('./1/07/suspectData.json'))); + global.courses = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'courses2.json')))); + global.suspectData = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '07', 'suspectData.json')))); } loadJS('07-reduce.js'); diff --git a/tutorial/common/loadJS.js b/tutorial/loadJS.js similarity index 100% rename from tutorial/common/loadJS.js rename to tutorial/loadJS.js From 0d41b5006ccb2c6c769c59fd6fb9d89b1f9fbbee Mon Sep 17 00:00:00 2001 From: ShMcK Date: Sun, 13 Mar 2016 18:19:41 -0700 Subject: [PATCH 10/46] change to use loadEditor, loadGlobal --- package.json | 6 +++--- tutorial/1/00/01-setup.spec.js | 11 ++--------- tutorial/1/01/01-filter.spec.js | 9 ++------- tutorial/1/02/01-sort.spec.js | 9 +++------ tutorial/1/03/01-map.spec.js | 9 +++------ tutorial/1/04/01-forEach.spec.js | 8 ++------ tutorial/1/05/01-find.spec.js | 8 ++------ tutorial/1/06/01-concat.spec.js | 9 ++------- tutorial/1/07/01-reduce.spec.js | 11 +++-------- tutorial/loadJS.js | 11 ----------- 10 files changed, 22 insertions(+), 69 deletions(-) delete mode 100644 tutorial/loadJS.js diff --git a/package.json b/package.json index afe335b..df393c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.2.0", + "version": "0.2.1", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -27,9 +27,9 @@ "dependencies": { "chai": "3.5.0", "chai-spies": "0.7.1", - "lodash": "4.5.1", + "lodash": "4.6.1", "mocha": "2.4.5", - "mocha-coderoad": "^0.4.2" + "mocha-coderoad": "^0.5.3" }, "license": "MIT", "config": { diff --git a/tutorial/1/00/01-setup.spec.js b/tutorial/1/00/01-setup.spec.js index 6704064..2e27719 100644 --- a/tutorial/1/00/01-setup.spec.js +++ b/tutorial/1/00/01-setup.spec.js @@ -2,18 +2,11 @@ var chai = require('chai'); var spies = require('chai-spies'); var expect = chai.expect; -var path = require('path'); chai.use(spies); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; - -if (!global.data) { - let data = require(path.join(process.env.TUTORIAL_DIR, 'data', 'students.json')); - global.data = JSON.parse(JSON.stringify(data)); -} - +loadGlobal('data', 'data/students.json'); var spy = chai.spy.on(console, 'log'); -loadJS('00-setup.js'); +loadEditor('00-setup.js'); describe('01 first', function () { diff --git a/tutorial/1/01/01-filter.spec.js b/tutorial/1/01/01-filter.spec.js index 19fd08b..ab65389 100644 --- a/tutorial/1/01/01-filter.spec.js +++ b/tutorial/1/01/01-filter.spec.js @@ -1,13 +1,8 @@ "use strict"; var expect = require('chai').expect; -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -if (!global.data) { - global.data = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'students.json')))); -} - -loadJS('01-filter.js'); +loadGlobal('data', 'data/students.json'); +loadEditor('01-filter.js'); describe('01 function isAda', function() { diff --git a/tutorial/1/02/01-sort.spec.js b/tutorial/1/02/01-sort.spec.js index edeb44a..a0ff5a9 100644 --- a/tutorial/1/02/01-sort.spec.js +++ b/tutorial/1/02/01-sort.spec.js @@ -1,10 +1,7 @@ var expect = require('chai').expect; -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -if (!global.myBest) { - global.myBest = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '02', 'myBest.json')))); -} -loadJS('02-sort.js'); + +loadGlobal('myBest', '1/02/myBest.json'); +loadEditor('02-sort.js'); describe('01 function compareScore', function () { it('doesn\'t exist', function() { diff --git a/tutorial/1/03/01-map.spec.js b/tutorial/1/03/01-map.spec.js index 4e4ec47..5f22b91 100644 --- a/tutorial/1/03/01-map.spec.js +++ b/tutorial/1/03/01-map.spec.js @@ -1,10 +1,7 @@ var expect = require('chai').expect; -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -if (!global.myData) { - global.myData = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '03', 'myData.json')))); -} -loadJS('03-map.js') + +loadGlobal('myData', '1/03/myData.json'); +loadEditor('03-map.js'); describe('01 function changeGrade', function() { diff --git a/tutorial/1/04/01-forEach.spec.js b/tutorial/1/04/01-forEach.spec.js index e7f932c..b8595b5 100644 --- a/tutorial/1/04/01-forEach.spec.js +++ b/tutorial/1/04/01-forEach.spec.js @@ -3,17 +3,13 @@ var chai = require('chai'); var spies = require('chai-spies'); var expect = chai.expect; chai.use(spies); -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; - -global.myFixed = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '04', 'myFixed.json')))); +loadGlobal('myFixed', '1/04/myFixed.json'); if (process.env.TASK_POSITION === '4') { global.myFixed = []; } - var spy = chai.spy.on(console, 'log'); -loadJS('04-forEach.js'); +loadEditor('04-forEach.js'); describe('01 console.log', function() { diff --git a/tutorial/1/05/01-find.spec.js b/tutorial/1/05/01-find.spec.js index 6a6b9f2..0c48fcd 100644 --- a/tutorial/1/05/01-find.spec.js +++ b/tutorial/1/05/01-find.spec.js @@ -1,13 +1,9 @@ 'use strict'; var expect = require('chai').expect; var spies = require('chai-spies'); -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -if (!global.students) { - global.students = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'students2.json')))); -} -loadJS('05-find.js'); +loadGlobal('students', 'data/students2.json'); +loadEditor('05-find.js'); describe('01 var myClass', function() { diff --git a/tutorial/1/06/01-concat.spec.js b/tutorial/1/06/01-concat.spec.js index 7540261..b0db55e 100644 --- a/tutorial/1/06/01-concat.spec.js +++ b/tutorial/1/06/01-concat.spec.js @@ -1,13 +1,8 @@ 'use strict'; var expect = require('chai').expect; -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -if (!global.courses) { - global.courses = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'courses2.json')))); -} - -loadJS('06-concat.js'); +loadGlobal('data/courses2.json'); +loadEditor('06-concat.js'); describe('01 var flattenedArray', function() { diff --git a/tutorial/1/07/01-reduce.spec.js b/tutorial/1/07/01-reduce.spec.js index dfdc72d..939baa0 100644 --- a/tutorial/1/07/01-reduce.spec.js +++ b/tutorial/1/07/01-reduce.spec.js @@ -1,14 +1,9 @@ "use strict"; var expect = require('chai').expect; -var path = require('path'); -var loadJS = require(path.join(process.env.TUTORIAL_DIR, 'loadJS')).default; -if (!global.courses) { - global.courses = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, 'data', 'courses2.json')))); - global.suspectData = JSON.parse(JSON.stringify(require(path.join(process.env.TUTORIAL_DIR, '1', '07', 'suspectData.json')))); -} - -loadJS('07-reduce.js'); +loadGlobal('courses', 'data/courses2.json'); +loadGlobal('suspectData', '1/07/suspectData.json'); +loadEditor('07-reduce.js'); describe('01 var total', function() { diff --git a/tutorial/loadJS.js b/tutorial/loadJS.js deleted file mode 100644 index 741a139..0000000 --- a/tutorial/loadJS.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -var vm = require('vm'); -var fs = require('fs'); -var path = require('path'); -function loadContext(pathToContext) { - var absPath = path.join(process.env.DIR, pathToContext); - var context = fs.readFileSync(absPath, 'utf8'); - vm.runInThisContext(context); -} -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = loadContext; From 1ab6d26d2582708f16403e72e34c137972ce05b5 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Sun, 20 Mar 2016 16:16:19 -0700 Subject: [PATCH 11/46] fix issue in 06-concat --- package.json | 2 +- tutorial/1/06/01-concat.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index df393c4..b7014cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.2.1", + "version": "0.2.2", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/1/06/01-concat.spec.js b/tutorial/1/06/01-concat.spec.js index b0db55e..8968789 100644 --- a/tutorial/1/06/01-concat.spec.js +++ b/tutorial/1/06/01-concat.spec.js @@ -1,7 +1,7 @@ 'use strict'; var expect = require('chai').expect; -loadGlobal('data/courses2.json'); +loadGlobal('courses', 'data/courses2.json'); loadEditor('06-concat.js'); describe('01 var flattenedArray', function() { From f51594521e1a36c9016e1bfdfd904dd1f8f48f36 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Fri, 1 Apr 2016 15:28:44 -0700 Subject: [PATCH 12/46] fix to use atom-coderoad loaders --- .gitignore | 2 +- tutorial/1/00/01-setup.spec.js | 6 +-- tutorial/1/00/setup.md | 12 ++--- tutorial/1/01/01-filter.spec.js | 4 +- tutorial/1/01/filter.md | 4 +- tutorial/1/02/01-sort.spec.js | 4 +- tutorial/1/02/{myBest.json => myBest.js} | 2 +- tutorial/1/03/01-map.spec.js | 4 +- tutorial/1/03/{myData.json => myData.js} | 2 +- tutorial/1/04/01-forEach.spec.js | 6 +-- tutorial/1/04/02-forEach.spec.js | 2 - tutorial/1/04/04-forEach.spec.js | 3 -- tutorial/1/05/01-find.spec.js | 4 +- tutorial/1/05/find.md | 2 +- tutorial/1/06/01-concat.spec.js | 4 +- tutorial/1/07/01-reduce.spec.js | 6 +-- .../1/07/{suspectData.json => suspectData.js} | 0 tutorial/data/{courses.json => courses.js} | 2 +- tutorial/data/{courses2.json => courses2.js} | 2 +- tutorial/data/{students.json => students.js} | 2 +- .../data/{students2.json => students2.js} | 2 +- tutorial/lib/students.js | 46 ------------------- tutorial/lib/students2.js | 46 ------------------- 23 files changed, 35 insertions(+), 132 deletions(-) rename tutorial/1/02/{myBest.json => myBest.js} (98%) rename tutorial/1/03/{myData.json => myData.js} (98%) rename tutorial/1/07/{suspectData.json => suspectData.js} (100%) rename tutorial/data/{courses.json => courses.js} (99%) rename tutorial/data/{courses2.json => courses2.js} (99%) rename tutorial/data/{students.json => students.js} (99%) rename tutorial/data/{students2.json => students2.js} (99%) delete mode 100644 tutorial/lib/students.js delete mode 100644 tutorial/lib/students2.js diff --git a/.gitignore b/.gitignore index 39baa73..d949b23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules dev -tutorial/.tmp.js +tutorial/_tmp.js diff --git a/tutorial/1/00/01-setup.spec.js b/tutorial/1/00/01-setup.spec.js index 2e27719..5cbc47e 100644 --- a/tutorial/1/00/01-setup.spec.js +++ b/tutorial/1/00/01-setup.spec.js @@ -3,10 +3,10 @@ var chai = require('chai'); var spies = require('chai-spies'); var expect = chai.expect; chai.use(spies); - -loadGlobal('data', 'data/students.json'); var spy = chai.spy.on(console, 'log'); -loadEditor('00-setup.js'); + +// load('data/students.js', true) +// load('00-setup.js') describe('01 first', function () { diff --git a/tutorial/1/00/setup.md b/tutorial/1/00/setup.md index 166acf6..6c57914 100644 --- a/tutorial/1/00/setup.md +++ b/tutorial/1/00/setup.md @@ -4,7 +4,7 @@ Understanding the Data Set Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. ```json -var data = [ +var students = [ { "title": "Relational Databases", "instructor": "Sean Quentin Lewis", @@ -20,12 +20,12 @@ Here we have an array of "student" objects. To get the first item in the array, ```js console.log( - 'first instructor', data[0].instructor + 'first instructor', students[0].instructor ); // first instructor Sean Quentin Lewis ``` -+ Set `first` to the first item in the `data` array. ++ Set `first` to the first item in the `students` array. @test('1/00/01-setup') @action(open('00-setup.js')) @action(set( @@ -35,8 +35,8 @@ console.log( var first = ::> ``` )) -@hint('Get the first item in data using the array index') -@hint('Access the title of `data[0]`') +@hint('Get the first item in students using the array index') +@hint('Access the title of `students[0]`') + Set `myName` to the "name" of the first student in the list. @@ -46,7 +46,7 @@ var first = ::> var myName= ::> ``` )) -@hint('Get the first "name" in the data using the array index') +@hint('Get the first "name" in the students using the array index') @hint('Access the "name" of `first`') @hint('Try `first.name`') diff --git a/tutorial/1/01/01-filter.spec.js b/tutorial/1/01/01-filter.spec.js index ab65389..a7b1a92 100644 --- a/tutorial/1/01/01-filter.spec.js +++ b/tutorial/1/01/01-filter.spec.js @@ -1,8 +1,8 @@ "use strict"; var expect = require('chai').expect; -loadGlobal('data', 'data/students.json'); -loadEditor('01-filter.js'); +// load('data/students.js', true) +// load('01-filter.js') describe('01 function isAda', function() { diff --git a/tutorial/1/01/filter.md b/tutorial/1/01/filter.md index 7d35970..d5d970a 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/1/01/filter.md @@ -43,7 +43,7 @@ Where were we? Back to filtering our grades. There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: ``` -console.log(data[0]); +console.log(students[0]); //> { course: 'Web Security', // instructor: 'Sue Denim', // name: 'Rebecca Heineman', @@ -74,7 +74,7 @@ function isAda(student) { @action(insert( ``` // run the function name in filter -var myData = data.filter(::>); +var myData = students.filter(::>); ``` )) @hint('Add a function to the `filter` call: `Array.filter(function() {})`') diff --git a/tutorial/1/02/01-sort.spec.js b/tutorial/1/02/01-sort.spec.js index a0ff5a9..5da2a7f 100644 --- a/tutorial/1/02/01-sort.spec.js +++ b/tutorial/1/02/01-sort.spec.js @@ -1,7 +1,7 @@ var expect = require('chai').expect; -loadGlobal('myBest', '1/02/myBest.json'); -loadEditor('02-sort.js'); +// load('1/02/myBest.js', true) +// load('02-sort.js') describe('01 function compareScore', function () { it('doesn\'t exist', function() { diff --git a/tutorial/1/02/myBest.json b/tutorial/1/02/myBest.js similarity index 98% rename from tutorial/1/02/myBest.json rename to tutorial/1/02/myBest.js index 4086748..1eef2b4 100644 --- a/tutorial/1/02/myBest.json +++ b/tutorial/1/02/myBest.js @@ -1,4 +1,4 @@ -[{ +var myBest = [{ "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "name": "Ada Lovelace", diff --git a/tutorial/1/03/01-map.spec.js b/tutorial/1/03/01-map.spec.js index 5f22b91..80e392b 100644 --- a/tutorial/1/03/01-map.spec.js +++ b/tutorial/1/03/01-map.spec.js @@ -1,7 +1,7 @@ var expect = require('chai').expect; -loadGlobal('myData', '1/03/myData.json'); -loadEditor('03-map.js'); +// load('1/03/myData.js', true) +// load('03-map.js') describe('01 function changeGrade', function() { diff --git a/tutorial/1/03/myData.json b/tutorial/1/03/myData.js similarity index 98% rename from tutorial/1/03/myData.json rename to tutorial/1/03/myData.js index 8b795e5..ea71ccd 100644 --- a/tutorial/1/03/myData.json +++ b/tutorial/1/03/myData.js @@ -1,4 +1,4 @@ -[{ +var myData = [{ "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "name": "Ada Lovelace", diff --git a/tutorial/1/04/01-forEach.spec.js b/tutorial/1/04/01-forEach.spec.js index b8595b5..8444ec5 100644 --- a/tutorial/1/04/01-forEach.spec.js +++ b/tutorial/1/04/01-forEach.spec.js @@ -4,12 +4,12 @@ var spies = require('chai-spies'); var expect = chai.expect; chai.use(spies); -loadGlobal('myFixed', '1/04/myFixed.json'); +// load('1/04/myFixed.js', true) if (process.env.TASK_POSITION === '4') { - global.myFixed = []; + myFixed = []; } var spy = chai.spy.on(console, 'log'); -loadEditor('04-forEach.js'); +// load('04-forEach.js') describe('01 console.log', function() { diff --git a/tutorial/1/04/02-forEach.spec.js b/tutorial/1/04/02-forEach.spec.js index 9a775a7..efefdc0 100644 --- a/tutorial/1/04/02-forEach.spec.js +++ b/tutorial/1/04/02-forEach.spec.js @@ -1,5 +1,3 @@ -'use strict'; - describe('02 console.log', function() { if (process.env.TASK_POSITION !== '4') { diff --git a/tutorial/1/04/04-forEach.spec.js b/tutorial/1/04/04-forEach.spec.js index 5d31f13..7835cff 100644 --- a/tutorial/1/04/04-forEach.spec.js +++ b/tutorial/1/04/04-forEach.spec.js @@ -1,6 +1,3 @@ -"use strict"; -var expect = require('chai').expect; - describe('04 log', function() { it('should pass', function () { diff --git a/tutorial/1/05/01-find.spec.js b/tutorial/1/05/01-find.spec.js index 0c48fcd..781315b 100644 --- a/tutorial/1/05/01-find.spec.js +++ b/tutorial/1/05/01-find.spec.js @@ -2,8 +2,8 @@ var expect = require('chai').expect; var spies = require('chai-spies'); -loadGlobal('students', 'data/students2.json'); -loadEditor('05-find.js'); +// load('data/students2.js', true) +// loadEditor('05-find.js'); describe('01 var myClass', function() { diff --git a/tutorial/1/05/find.md b/tutorial/1/05/find.md index 62e69f9..04a3603 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/1/05/find.md @@ -25,7 +25,7 @@ data.find(isEven); Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. -+ `filter` to students in the class titled "Web Security" ++ `filter` to `students` in the class titled "Web Security" @test('1/05/01-find') @action(open('05-find.js')) @action(set( diff --git a/tutorial/1/06/01-concat.spec.js b/tutorial/1/06/01-concat.spec.js index 8968789..19902e9 100644 --- a/tutorial/1/06/01-concat.spec.js +++ b/tutorial/1/06/01-concat.spec.js @@ -1,8 +1,8 @@ 'use strict'; var expect = require('chai').expect; -loadGlobal('courses', 'data/courses2.json'); -loadEditor('06-concat.js'); +// load('data/courses2.json', true) +// load('06-concat.js'); describe('01 var flattenedArray', function() { diff --git a/tutorial/1/07/01-reduce.spec.js b/tutorial/1/07/01-reduce.spec.js index 939baa0..1f06527 100644 --- a/tutorial/1/07/01-reduce.spec.js +++ b/tutorial/1/07/01-reduce.spec.js @@ -1,9 +1,9 @@ "use strict"; var expect = require('chai').expect; -loadGlobal('courses', 'data/courses2.json'); -loadGlobal('suspectData', '1/07/suspectData.json'); -loadEditor('07-reduce.js'); +// load('data/courses2.json', true) +// load('1/07/suspectData.js') +// load('07-reduce.js') describe('01 var total', function() { diff --git a/tutorial/1/07/suspectData.json b/tutorial/1/07/suspectData.js similarity index 100% rename from tutorial/1/07/suspectData.json rename to tutorial/1/07/suspectData.js diff --git a/tutorial/data/courses.json b/tutorial/data/courses.js similarity index 99% rename from tutorial/data/courses.json rename to tutorial/data/courses.js index d68752d..94c9615 100644 --- a/tutorial/data/courses.json +++ b/tutorial/data/courses.js @@ -1,4 +1,4 @@ -[ +var courses = [ { "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "students": [{ "name": "Ada Lovelace", "score": 91, "grade": "A" },{ "name": "Albert Gonzalez", "score": 35, "grade": "F" },{ "name": "Brian Kernaghan", "score": 35, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 78, "grade": "C" },{ "name": "Donald Knuth", "score": 94, "grade": "A" },{ "name": "Grace Hopper", "score": 36, "grade": "F" },{ "name": "Hack Kerr", "score": 85, "grade": "F" },{ "name": "James Gosling", "score": 30, "grade": "F" },{ "name": "Ken Thompson", "score": 30, "grade": "F" },{ "name": "Kevin Mitnick", "score": 72, "grade": "C" },{ "name": "Linus Torvalds", "score": 34, "grade": "F" },{ "name": "Niklaus Wirth", "score": 75, "grade": "C" },{ "name": "Rebecca Heineman", "score": 71, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 54, "grade": "F" },{ "name": "Xiao Tian", "score": 67, "grade": "D" },{ "name": "Ying Cracker", "score": 57, "grade": "F" }] }, { "title": "3D Computer Graphics", "instructor": "G.L. Webb", "students": [{ "name": "Ada Lovelace", "score": 88, "grade": "B" },{ "name": "Albert Gonzalez", "score": 37, "grade": "F" },{ "name": "Brian Kernaghan", "score": 76, "grade": "C" },{ "name": "Danielle Bunten Berry", "score": 53, "grade": "F" },{ "name": "Donald Knuth", "score": 34, "grade": "F" },{ "name": "Grace Hopper", "score": 74, "grade": "C" },{ "name": "Hack Kerr", "score": 86, "grade": "F" },{ "name": "James Gosling", "score": 94, "grade": "A" },{ "name": "Ken Thompson", "score": 48, "grade": "F" },{ "name": "Kevin Mitnick", "score": 52, "grade": "F" },{ "name": "Linus Torvalds", "score": 90, "grade": "A" },{ "name": "Niklaus Wirth", "score": 78, "grade": "C" },{ "name": "Rebecca Heineman", "score": 73, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 94, "grade": "A" },{ "name": "Xiao Tian", "score": 45, "grade": "F" },{ "name": "Ying Cracker", "score": 77, "grade": "C" }] }, { "title": "Front End Web Development", "instructor": "Moe Zaick", "students": [{ "name": "Ada Lovelace", "score": 61, "grade": "D" },{ "name": "Albert Gonzalez", "score": 73, "grade": "C" },{ "name": "Brian Kernaghan", "score": 47, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 87, "grade": "B" },{ "name": "Donald Knuth", "score": 80, "grade": "B" },{ "name": "Grace Hopper", "score": 80, "grade": "B" },{ "name": "Hack Kerr", "score": 92, "grade": "C" },{ "name": "James Gosling", "score": 97, "grade": "A" },{ "name": "Ken Thompson", "score": 64, "grade": "D" },{ "name": "Kevin Mitnick", "score": 47, "grade": "F" },{ "name": "Linus Torvalds", "score": 58, "grade": "F" },{ "name": "Niklaus Wirth", "score": 93, "grade": "A" },{ "name": "Rebecca Heineman", "score": 58, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 98, "grade": "A" },{ "name": "Xiao Tian", "score": 36, "grade": "F" },{ "name": "Ying Cracker", "score": 73, "grade": "C" }] }, diff --git a/tutorial/data/courses2.json b/tutorial/data/courses2.js similarity index 99% rename from tutorial/data/courses2.json rename to tutorial/data/courses2.js index 6dcc6d8..7669fd6 100644 --- a/tutorial/data/courses2.json +++ b/tutorial/data/courses2.js @@ -1,4 +1,4 @@ -[ +var courses = [ { "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "students": [{ "name": "!f", "score": 61, "grade": "D" },{ "name": "Albert Gonzalez", "score": 35, "grade": "F" },{ "name": "Brian Kernaghan", "score": 35, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 78, "grade": "C" },{ "name": "Donald Knuth", "score": 94, "grade": "A" },{ "name": "Grace Hopper", "score": 36, "grade": "F" },{ "name": "Hack Kerr", "score": 85, "grade": "F" },{ "name": "James Gosling", "score": 30, "grade": "F" },{ "name": "Ken Thompson", "score": 30, "grade": "F" },{ "name": "Kevin Mitnick", "score": 72, "grade": "C" },{ "name": "Linus Torvalds", "score": 34, "grade": "F" },{ "name": "Niklaus Wirth", "score": 75, "grade": "C" },{ "name": "Rebecca Heineman", "score": 71, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 54, "grade": "F" },{ "name": "Xiao Tian", "score": 67, "grade": "D" },{ "name": "Ying Cracker", "score": 57, "grade": "F" }] }, { "title": "3D Computer Graphics", "instructor": "G.L. Webb", "students": [{ "name": "in", "score": 58, "grade": "F" },{ "name": "Albert Gonzalez", "score": 37, "grade": "F" },{ "name": "Brian Kernaghan", "score": 76, "grade": "C" },{ "name": "Danielle Bunten Berry", "score": 53, "grade": "F" },{ "name": "Donald Knuth", "score": 34, "grade": "F" },{ "name": "Grace Hopper", "score": 74, "grade": "C" },{ "name": "Hack Kerr", "score": 86, "grade": "F" },{ "name": "James Gosling", "score": 94, "grade": "A" },{ "name": "Ken Thompson", "score": 48, "grade": "F" },{ "name": "Kevin Mitnick", "score": 52, "grade": "F" },{ "name": "Linus Torvalds", "score": 90, "grade": "A" },{ "name": "Niklaus Wirth", "score": 78, "grade": "C" },{ "name": "Rebecca Heineman", "score": 73, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 94, "grade": "A" },{ "name": "Xiao Tian", "score": 45, "grade": "F" },{ "name": "Ying Cracker", "score": 77, "grade": "C" }] }, { "title": "Front End Web Development", "instructor": "Moe Zaick", "students": [{ "name": "dt", "score": 31, "grade": "F" },{ "name": "Albert Gonzalez", "score": 73, "grade": "C" },{ "name": "Brian Kernaghan", "score": 47, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 87, "grade": "B" },{ "name": "Donald Knuth", "score": 80, "grade": "B" },{ "name": "Grace Hopper", "score": 80, "grade": "B" },{ "name": "Hack Kerr", "score": 92, "grade": "C" },{ "name": "James Gosling", "score": 97, "grade": "A" },{ "name": "Ken Thompson", "score": 64, "grade": "D" },{ "name": "Kevin Mitnick", "score": 47, "grade": "F" },{ "name": "Linus Torvalds", "score": 58, "grade": "F" },{ "name": "Niklaus Wirth", "score": 93, "grade": "A" },{ "name": "Rebecca Heineman", "score": 58, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 98, "grade": "A" },{ "name": "Xiao Tian", "score": 36, "grade": "F" },{ "name": "Ying Cracker", "score": 73, "grade": "C" }] }, diff --git a/tutorial/data/students.json b/tutorial/data/students.js similarity index 99% rename from tutorial/data/students.json rename to tutorial/data/students.js index 70c1951..964a241 100644 --- a/tutorial/data/students.json +++ b/tutorial/data/students.js @@ -1,4 +1,4 @@ -[{ +var students = [{ "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "name": "Ada Lovelace", diff --git a/tutorial/data/students2.json b/tutorial/data/students2.js similarity index 99% rename from tutorial/data/students2.json rename to tutorial/data/students2.js index fb51457..7981d9f 100644 --- a/tutorial/data/students2.json +++ b/tutorial/data/students2.js @@ -1,4 +1,4 @@ -[{ +var students = [{ "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "name": "!f", diff --git a/tutorial/lib/students.js b/tutorial/lib/students.js deleted file mode 100644 index a6033d3..0000000 --- a/tutorial/lib/students.js +++ /dev/null @@ -1,46 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Date: Fri, 1 Apr 2016 15:33:06 -0700 Subject: [PATCH 13/46] fix and compress data files --- tutorial/1/02/myBest.js | 44 +- tutorial/1/03/myData.js | 62 +-- tutorial/1/04/myFixed.js | 1 + tutorial/1/04/myFixed.json | 61 --- tutorial/1/07/suspectData.js | 2 +- tutorial/data/courses.js | 13 +- tutorial/data/courses2.js | 13 +- tutorial/data/students.js | 962 +---------------------------------- tutorial/data/students2.js | 962 +---------------------------------- 9 files changed, 8 insertions(+), 2112 deletions(-) create mode 100644 tutorial/1/04/myFixed.js delete mode 100644 tutorial/1/04/myFixed.json diff --git a/tutorial/1/02/myBest.js b/tutorial/1/02/myBest.js index 1eef2b4..d44a06b 100644 --- a/tutorial/1/02/myBest.js +++ b/tutorial/1/02/myBest.js @@ -1,43 +1 @@ -var myBest = [{ - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ada Lovelace", - "score": 88, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ada Lovelace", - "score": 81, - "grade": "B" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ada Lovelace", - "score": 73, - "grade": "C" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ada Lovelace", - "score": 93, - "grade": "A" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ada Lovelace", - "score": 82, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ada Lovelace", - "score": 88, - "grade": "B" -}] +var myBest=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"}]; diff --git a/tutorial/1/03/myData.js b/tutorial/1/03/myData.js index ea71ccd..f2b6e03 100644 --- a/tutorial/1/03/myData.js +++ b/tutorial/1/03/myData.js @@ -1,61 +1 @@ -var myData = [{ - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ada Lovelace", - "score": 88, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ada Lovelace", - "score": 61, - "grade": "D" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ada Lovelace", - "score": 81, - "grade": "B" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ada Lovelace", - "score": 73, - "grade": "C" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ada Lovelace", - "score": 58, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ada Lovelace", - "score": 93, - "grade": "A" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ada Lovelace", - "score": 82, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ada Lovelace", - "score": 88, - "grade": "B" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ada Lovelace", - "score": 65, - "grade": "D" -}] +var myData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"}]; diff --git a/tutorial/1/04/myFixed.js b/tutorial/1/04/myFixed.js new file mode 100644 index 0000000..80eae5d --- /dev/null +++ b/tutorial/1/04/myFixed.js @@ -0,0 +1 @@ +var myFixed=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:95,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:95,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:85,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:95,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:94,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:95,grade:"A"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:77,grade:"C"}]; diff --git a/tutorial/1/04/myFixed.json b/tutorial/1/04/myFixed.json deleted file mode 100644 index 2c9f38b..0000000 --- a/tutorial/1/04/myFixed.json +++ /dev/null @@ -1,61 +0,0 @@ -[{ - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 95, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ada Lovelace", - "score": 95, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ada Lovelace", - "score": 73, - "grade": "C" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ada Lovelace", - "score": 93, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ada Lovelace", - "score": 85, - "grade": "B" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ada Lovelace", - "score": 70, - "grade": "C" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ada Lovelace", - "score": 95, - "grade": "A" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ada Lovelace", - "score": 94, - "grade": "A" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ada Lovelace", - "score": 95, - "grade": "A" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ada Lovelace", - "score": 77, - "grade": "C" -}] diff --git a/tutorial/1/07/suspectData.js b/tutorial/1/07/suspectData.js index db363ab..c5db90c 100644 --- a/tutorial/1/07/suspectData.js +++ b/tutorial/1/07/suspectData.js @@ -1 +1 @@ -[{"title":"Relational Databases","instructor":"Sean Quentin Lewis","name":"Albert Gonzalez","score":35,"grade":"F"},{"title":"Relational Databases","instructor":"Sean Quentin Lewis","name":"Hack Kerr","score":85,"grade":"F"},{"title":"Relational Databases","instructor":"Sean Quentin Lewis","name":"Kevin Mitnick","score":72,"grade":"C"},{"title":"3D Computer Graphics","instructor":"G.L. Webb","name":"Albert Gonzalez","score":37,"grade":"F"},{"title":"3D Computer Graphics","instructor":"G.L. Webb","name":"Hack Kerr","score":86,"grade":"F"},{"title":"3D Computer Graphics","instructor":"G.L. Webb","name":"Kevin Mitnick","score":52,"grade":"F"},{"title":"Front End Web Development","instructor":"Moe Zaick","name":"Albert Gonzalez","score":73,"grade":"C"},{"title":"Front End Web Development","instructor":"Moe Zaick","name":"Hack Kerr","score":92,"grade":"C"},{"title":"Front End Web Development","instructor":"Moe Zaick","name":"Kevin Mitnick","score":47,"grade":"F"},{"title":"Web Security","instructor":"Sue Denim","name":"Albert Gonzalez","score":74,"grade":"C"},{"title":"Web Security","instructor":"Sue Denim","name":"Hack Kerr","score":75,"grade":"F"},{"title":"Web Security","instructor":"Sue Denim","name":"Kevin Mitnick","score":89,"grade":"B"},{"title":"Javascript Fundamentals","instructor":"Jay Kweerie","name":"Albert Gonzalez","score":94,"grade":"A"},{"title":"Javascript Fundamentals","instructor":"Jay Kweerie","name":"Hack Kerr","score":83,"grade":"F"},{"title":"Javascript Fundamentals","instructor":"Jay Kweerie","name":"Kevin Mitnick","score":47,"grade":"F"},{"title":"Data Science","instructor":"Ford Fulkerson","name":"Albert Gonzalez","score":67,"grade":"D"},{"title":"Data Science","instructor":"Ford Fulkerson","name":"Hack Kerr","score":96,"grade":"A"},{"title":"Data Science","instructor":"Ford Fulkerson","name":"Kevin Mitnick","score":75,"grade":"C"},{"title":"Algorithm Design","instructor":"Gale Shapely","name":"Albert Gonzalez","score":39,"grade":"F"},{"title":"Algorithm Design","instructor":"Gale Shapely","name":"Hack Kerr","score":94,"grade":"A"},{"title":"Algorithm Design","instructor":"Gale Shapely","name":"Kevin Mitnick","score":81,"grade":"B"},{"title":"Data Abstraction","instructor":"Aster Ricks","name":"Albert Gonzalez","score":70,"grade":"C"},{"title":"Data Abstraction","instructor":"Aster Ricks","name":"Hack Kerr","score":87,"grade":"F"},{"title":"Data Abstraction","instructor":"Aster Ricks","name":"Kevin Mitnick","score":41,"grade":"F"},{"title":"Data Structures","instructor":"Brodal Q.","name":"Albert Gonzalez","score":56,"grade":"F"},{"title":"Data Structures","instructor":"Brodal Q.","name":"Hack Kerr","score":89,"grade":"B"},{"title":"Data Structures","instructor":"Brodal Q.","name":"Kevin Mitnick","score":40,"grade":"F"},{"title":"Networks","instructor":"Van Emde Boas","name":"Albert Gonzalez","score":52,"grade":"F"},{"title":"Networks","instructor":"Van Emde Boas","name":"Hack Kerr","score":102,"grade":"F"},{"title":"Networks","instructor":"Van Emde Boas","name":"Kevin Mitnick","score":37,"grade":"F"}] +var suspectData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"}]; diff --git a/tutorial/data/courses.js b/tutorial/data/courses.js index 94c9615..43b11b3 100644 --- a/tutorial/data/courses.js +++ b/tutorial/data/courses.js @@ -1,12 +1 @@ -var courses = [ -{ "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "students": [{ "name": "Ada Lovelace", "score": 91, "grade": "A" },{ "name": "Albert Gonzalez", "score": 35, "grade": "F" },{ "name": "Brian Kernaghan", "score": 35, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 78, "grade": "C" },{ "name": "Donald Knuth", "score": 94, "grade": "A" },{ "name": "Grace Hopper", "score": 36, "grade": "F" },{ "name": "Hack Kerr", "score": 85, "grade": "F" },{ "name": "James Gosling", "score": 30, "grade": "F" },{ "name": "Ken Thompson", "score": 30, "grade": "F" },{ "name": "Kevin Mitnick", "score": 72, "grade": "C" },{ "name": "Linus Torvalds", "score": 34, "grade": "F" },{ "name": "Niklaus Wirth", "score": 75, "grade": "C" },{ "name": "Rebecca Heineman", "score": 71, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 54, "grade": "F" },{ "name": "Xiao Tian", "score": 67, "grade": "D" },{ "name": "Ying Cracker", "score": 57, "grade": "F" }] }, -{ "title": "3D Computer Graphics", "instructor": "G.L. Webb", "students": [{ "name": "Ada Lovelace", "score": 88, "grade": "B" },{ "name": "Albert Gonzalez", "score": 37, "grade": "F" },{ "name": "Brian Kernaghan", "score": 76, "grade": "C" },{ "name": "Danielle Bunten Berry", "score": 53, "grade": "F" },{ "name": "Donald Knuth", "score": 34, "grade": "F" },{ "name": "Grace Hopper", "score": 74, "grade": "C" },{ "name": "Hack Kerr", "score": 86, "grade": "F" },{ "name": "James Gosling", "score": 94, "grade": "A" },{ "name": "Ken Thompson", "score": 48, "grade": "F" },{ "name": "Kevin Mitnick", "score": 52, "grade": "F" },{ "name": "Linus Torvalds", "score": 90, "grade": "A" },{ "name": "Niklaus Wirth", "score": 78, "grade": "C" },{ "name": "Rebecca Heineman", "score": 73, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 94, "grade": "A" },{ "name": "Xiao Tian", "score": 45, "grade": "F" },{ "name": "Ying Cracker", "score": 77, "grade": "C" }] }, -{ "title": "Front End Web Development", "instructor": "Moe Zaick", "students": [{ "name": "Ada Lovelace", "score": 61, "grade": "D" },{ "name": "Albert Gonzalez", "score": 73, "grade": "C" },{ "name": "Brian Kernaghan", "score": 47, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 87, "grade": "B" },{ "name": "Donald Knuth", "score": 80, "grade": "B" },{ "name": "Grace Hopper", "score": 80, "grade": "B" },{ "name": "Hack Kerr", "score": 92, "grade": "C" },{ "name": "James Gosling", "score": 97, "grade": "A" },{ "name": "Ken Thompson", "score": 64, "grade": "D" },{ "name": "Kevin Mitnick", "score": 47, "grade": "F" },{ "name": "Linus Torvalds", "score": 58, "grade": "F" },{ "name": "Niklaus Wirth", "score": 93, "grade": "A" },{ "name": "Rebecca Heineman", "score": 58, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 98, "grade": "A" },{ "name": "Xiao Tian", "score": 36, "grade": "F" },{ "name": "Ying Cracker", "score": 73, "grade": "C" }] }, -{ "title": "Web Security", "instructor": "Sue Denim", "students": [{ "name": "Ada Lovelace", "score": 81, "grade": "B" },{ "name": "Albert Gonzalez", "score": 74, "grade": "C" },{ "name": "Brian Kernaghan", "score": 92, "grade": "A" },{ "name": "Danielle Bunten Berry", "score": 34, "grade": "F" },{ "name": "Donald Knuth", "score": 44, "grade": "F" },{ "name": "Grace Hopper", "score": 81, "grade": "B" },{ "name": "Hack Kerr", "score": 75, "grade": "F" },{ "name": "James Gosling", "score": 95, "grade": "A" },{ "name": "Ken Thompson", "score": 84, "grade": "B" },{ "name": "Kevin Mitnick", "score": 89, "grade": "B" },{ "name": "Linus Torvalds", "score": 57, "grade": "F" },{ "name": "Niklaus Wirth", "score": 88, "grade": "B" },{ "name": "Rebecca Heineman", "score": 93, "grade": "A" },{ "name": "Tim Berners-Lee", "score": 36, "grade": "F" },{ "name": "Xiao Tian", "score": 87, "grade": "B" },{ "name": "Ying Cracker", "score": 42, "grade": "F" }] }, -{ "title": "Javascript Fundamentals", "instructor": "Jay Kweerie", "students": [{ "name": "Ada Lovelace", "score": 73, "grade": "C" },{ "name": "Albert Gonzalez", "score": 94, "grade": "A" },{ "name": "Brian Kernaghan", "score": 71, "grade": "C" },{ "name": "Danielle Bunten Berry", "score": 66, "grade": "D" },{ "name": "Donald Knuth", "score": 94, "grade": "A" },{ "name": "Grace Hopper", "score": 99, "grade": "A" },{ "name": "Hack Kerr", "score": 83, "grade": "F" },{ "name": "James Gosling", "score": 99, "grade": "A" },{ "name": "Ken Thompson", "score": 65, "grade": "D" },{ "name": "Kevin Mitnick", "score": 47, "grade": "F" },{ "name": "Linus Torvalds", "score": 93, "grade": "A" },{ "name": "Niklaus Wirth", "score": 50, "grade": "F" },{ "name": "Rebecca Heineman", "score": 33, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 51, "grade": "F" },{ "name": "Xiao Tian", "score": 87, "grade": "B" },{ "name": "Ying Cracker", "score": 60, "grade": "D" }] }, -{ "title": "Data Science", "instructor": "Ford Fulkerson", "students": [{ "name": "Ada Lovelace", "score": 58, "grade": "F" },{ "name": "Albert Gonzalez", "score": 67, "grade": "D" },{ "name": "Brian Kernaghan", "score": 66, "grade": "D" },{ "name": "Danielle Bunten Berry", "score": 36, "grade": "F" },{ "name": "Donald Knuth", "score": 36, "grade": "F" },{ "name": "Grace Hopper", "score": 66, "grade": "D" },{ "name": "Hack Kerr", "score": 96, "grade": "A" },{ "name": "James Gosling", "score": 83, "grade": "B" },{ "name": "Ken Thompson", "score": 35, "grade": "F" },{ "name": "Kevin Mitnick", "score": 75, "grade": "C" },{ "name": "Linus Torvalds", "score": 63, "grade": "D" },{ "name": "Niklaus Wirth", "score": 75, "grade": "C" },{ "name": "Rebecca Heineman", "score": 84, "grade": "B" },{ "name": "Tim Berners-Lee", "score": 41, "grade": "F" },{ "name": "Xiao Tian", "score": 49, "grade": "F" },{ "name": "Ying Cracker", "score": 96, "grade": "A" }] }, -{ "title": "Algorithm Design", "instructor": "Gale Shapely", "students": [{ "name": "Ada Lovelace", "score": 93, "grade": "A" },{ "name": "Albert Gonzalez", "score": 39, "grade": "F" },{ "name": "Brian Kernaghan", "score": 69, "grade": "D" },{ "name": "Danielle Bunten Berry", "score": 54, "grade": "F" },{ "name": "Donald Knuth", "score": 83, "grade": "B" },{ "name": "Grace Hopper", "score": 31, "grade": "F" },{ "name": "Hack Kerr", "score": 94, "grade": "A" },{ "name": "James Gosling", "score": 35, "grade": "F" },{ "name": "Ken Thompson", "score": 67, "grade": "D" },{ "name": "Kevin Mitnick", "score": 81, "grade": "B" },{ "name": "Linus Torvalds", "score": 70, "grade": "C" },{ "name": "Niklaus Wirth", "score": 74, "grade": "C" },{ "name": "Rebecca Heineman", "score": 92, "grade": "A" },{ "name": "Tim Berners-Lee", "score": 48, "grade": "F" },{ "name": "Xiao Tian", "score": 80, "grade": "B" },{ "name": "Ying Cracker", "score": 84, "grade": "B" }] }, -{ "title": "Data Abstraction", "instructor": "Aster Ricks", "students": [{ "name": "Ada Lovelace", "score": 82, "grade": "B" },{ "name": "Albert Gonzalez", "score": 70, "grade": "C" },{ "name": "Brian Kernaghan", "score": 89, "grade": "B" },{ "name": "Danielle Bunten Berry", "score": 38, "grade": "F" },{ "name": "Donald Knuth", "score": 86, "grade": "B" },{ "name": "Grace Hopper", "score": 42, "grade": "F" },{ "name": "Hack Kerr", "score": 87, "grade": "F" },{ "name": "James Gosling", "score": 89, "grade": "B" },{ "name": "Ken Thompson", "score": 86, "grade": "B" },{ "name": "Kevin Mitnick", "score": 41, "grade": "F" },{ "name": "Linus Torvalds", "score": 76, "grade": "C" },{ "name": "Niklaus Wirth", "score": 78, "grade": "C" },{ "name": "Rebecca Heineman", "score": 70, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 74, "grade": "C" },{ "name": "Xiao Tian", "score": 93, "grade": "A" },{ "name": "Ying Cracker", "score": 95, "grade": "A" }] }, -{ "title": "Data Structures", "instructor": "Brodal Q.", "students": [{ "name": "Ada Lovelace", "score": 88, "grade": "B" },{ "name": "Albert Gonzalez", "score": 56, "grade": "F" },{ "name": "Brian Kernaghan", "score": 58, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 38, "grade": "F" },{ "name": "Donald Knuth", "score": 85, "grade": "B" },{ "name": "Grace Hopper", "score": 53, "grade": "F" },{ "name": "Hack Kerr", "score": 89, "grade": "B" },{ "name": "James Gosling", "score": 42, "grade": "F" },{ "name": "Ken Thompson", "score": 87, "grade": "B" },{ "name": "Kevin Mitnick", "score": 40, "grade": "F" },{ "name": "Linus Torvalds", "score": 91, "grade": "A" },{ "name": "Niklaus Wirth", "score": 51, "grade": "F" },{ "name": "Rebecca Heineman", "score": 79, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 37, "grade": "F" },{ "name": "Xiao Tian", "score": 84, "grade": "B" },{ "name": "Ying Cracker", "score": 45, "grade": "F" }] }, -{ "title": "Networks", "instructor": "Van Emde Boas", "students": [{ "name": "Ada Lovelace", "score": 65, "grade": "D" },{ "name": "Albert Gonzalez", "score": 52, "grade": "F" },{ "name": "Brian Kernaghan", "score": 61, "grade": "D" },{ "name": "Danielle Bunten Berry", "score": 59, "grade": "F" },{ "name": "Donald Knuth", "score": 89, "grade": "B" },{ "name": "Grace Hopper", "score": 40, "grade": "F" },{ "name": "Hack Kerr", "score": 102, "grade": "F" },{ "name": "James Gosling", "score": 39, "grade": "F" },{ "name": "Ken Thompson", "score": 83, "grade": "B" },{ "name": "Kevin Mitnick", "score": 37, "grade": "F" },{ "name": "Linus Torvalds", "score": 65, "grade": "D" },{ "name": "Niklaus Wirth", "score": 36, "grade": "F" },{ "name": "Rebecca Heineman", "score": 32, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 70, "grade": "C" },{ "name": "Xiao Tian", "score": 52, "grade": "F" },{ "name": "Ying Cracker", "score": 62, "grade": "D" }] } -] +var courses=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",students:[{name:"Ada Lovelace",score:91,grade:"A"},{name:"Albert Gonzalez",score:35,grade:"F"},{name:"Brian Kernaghan",score:35,grade:"F"},{name:"Danielle Bunten Berry",score:78,grade:"C"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:36,grade:"F"},{name:"Hack Kerr",score:85,grade:"F"},{name:"James Gosling",score:30,grade:"F"},{name:"Ken Thompson",score:30,grade:"F"},{name:"Kevin Mitnick",score:72,grade:"C"},{name:"Linus Torvalds",score:34,grade:"F"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:71,grade:"C"},{name:"Tim Berners-Lee",score:54,grade:"F"},{name:"Xiao Tian",score:67,grade:"D"},{name:"Ying Cracker",score:57,grade:"F"}]},{title:"3D Computer Graphics",instructor:"G.L. Webb",students:[{name:"Ada Lovelace",score:88,grade:"B"},{name:"Albert Gonzalez",score:37,grade:"F"},{name:"Brian Kernaghan",score:76,grade:"C"},{name:"Danielle Bunten Berry",score:53,grade:"F"},{name:"Donald Knuth",score:34,grade:"F"},{name:"Grace Hopper",score:74,grade:"C"},{name:"Hack Kerr",score:86,grade:"F"},{name:"James Gosling",score:94,grade:"A"},{name:"Ken Thompson",score:48,grade:"F"},{name:"Kevin Mitnick",score:52,grade:"F"},{name:"Linus Torvalds",score:90,grade:"A"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:73,grade:"C"},{name:"Tim Berners-Lee",score:94,grade:"A"},{name:"Xiao Tian",score:45,grade:"F"},{name:"Ying Cracker",score:77,grade:"C"}]},{title:"Front End Web Development",instructor:"Moe Zaick",students:[{name:"Ada Lovelace",score:61,grade:"D"},{name:"Albert Gonzalez",score:73,grade:"C"},{name:"Brian Kernaghan",score:47,grade:"F"},{name:"Danielle Bunten Berry",score:87,grade:"B"},{name:"Donald Knuth",score:80,grade:"B"},{name:"Grace Hopper",score:80,grade:"B"},{name:"Hack Kerr",score:92,grade:"C"},{name:"James Gosling",score:97,grade:"A"},{name:"Ken Thompson",score:64,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:58,grade:"F"},{name:"Niklaus Wirth",score:93,grade:"A"},{name:"Rebecca Heineman",score:58,grade:"F"},{name:"Tim Berners-Lee",score:98,grade:"A"},{name:"Xiao Tian",score:36,grade:"F"},{name:"Ying Cracker",score:73,grade:"C"}]},{title:"Web Security",instructor:"Sue Denim",students:[{name:"Ada Lovelace",score:81,grade:"B"},{name:"Albert Gonzalez",score:74,grade:"C"},{name:"Brian Kernaghan",score:92,grade:"A"},{name:"Danielle Bunten Berry",score:34,grade:"F"},{name:"Donald Knuth",score:44,grade:"F"},{name:"Grace Hopper",score:81,grade:"B"},{name:"Hack Kerr",score:75,grade:"F"},{name:"James Gosling",score:95,grade:"A"},{name:"Ken Thompson",score:84,grade:"B"},{name:"Kevin Mitnick",score:89,grade:"B"},{name:"Linus Torvalds",score:57,grade:"F"},{name:"Niklaus Wirth",score:88,grade:"B"},{name:"Rebecca Heineman",score:93,grade:"A"},{name:"Tim Berners-Lee",score:36,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:42,grade:"F"}]},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",students:[{name:"Ada Lovelace",score:73,grade:"C"},{name:"Albert Gonzalez",score:94,grade:"A"},{name:"Brian Kernaghan",score:71,grade:"C"},{name:"Danielle Bunten Berry",score:66,grade:"D"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:99,grade:"A"},{name:"Hack Kerr",score:83,grade:"F"},{name:"James Gosling",score:99,grade:"A"},{name:"Ken Thompson",score:65,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:93,grade:"A"},{name:"Niklaus Wirth",score:50,grade:"F"},{name:"Rebecca Heineman",score:33,grade:"F"},{name:"Tim Berners-Lee",score:51,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:60,grade:"D"}]},{title:"Data Science",instructor:"Ford Fulkerson",students:[{name:"Ada Lovelace",score:58,grade:"F"},{name:"Albert Gonzalez",score:67,grade:"D"},{name:"Brian Kernaghan",score:66,grade:"D"},{name:"Danielle Bunten Berry",score:36,grade:"F"},{name:"Donald Knuth",score:36,grade:"F"},{name:"Grace Hopper",score:66,grade:"D"},{name:"Hack Kerr",score:96,grade:"A"},{name:"James Gosling",score:83,grade:"B"},{name:"Ken Thompson",score:35,grade:"F"},{name:"Kevin Mitnick",score:75,grade:"C"},{name:"Linus Torvalds",score:63,grade:"D"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:84,grade:"B"},{name:"Tim Berners-Lee",score:41,grade:"F"},{name:"Xiao Tian",score:49,grade:"F"},{name:"Ying Cracker",score:96,grade:"A"}]},{title:"Algorithm Design",instructor:"Gale Shapely",students:[{name:"Ada Lovelace",score:93,grade:"A"},{name:"Albert Gonzalez",score:39,grade:"F"},{name:"Brian Kernaghan",score:69,grade:"D"},{name:"Danielle Bunten Berry",score:54,grade:"F"},{name:"Donald Knuth",score:83,grade:"B"},{name:"Grace Hopper",score:31,grade:"F"},{name:"Hack Kerr",score:94,grade:"A"},{name:"James Gosling",score:35,grade:"F"},{name:"Ken Thompson",score:67,grade:"D"},{name:"Kevin Mitnick",score:81,grade:"B"},{name:"Linus Torvalds",score:70,grade:"C"},{name:"Niklaus Wirth",score:74,grade:"C"},{name:"Rebecca Heineman",score:92,grade:"A"},{name:"Tim Berners-Lee",score:48,grade:"F"},{name:"Xiao Tian",score:80,grade:"B"},{name:"Ying Cracker",score:84,grade:"B"}]},{title:"Data Abstraction",instructor:"Aster Ricks",students:[{name:"Ada Lovelace",score:82,grade:"B"},{name:"Albert Gonzalez",score:70,grade:"C"},{name:"Brian Kernaghan",score:89,grade:"B"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:86,grade:"B"},{name:"Grace Hopper",score:42,grade:"F"},{name:"Hack Kerr",score:87,grade:"F"},{name:"James Gosling",score:89,grade:"B"},{name:"Ken Thompson",score:86,grade:"B"},{name:"Kevin Mitnick",score:41,grade:"F"},{name:"Linus Torvalds",score:76,grade:"C"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:70,grade:"C"},{name:"Tim Berners-Lee",score:74,grade:"C"},{name:"Xiao Tian",score:93,grade:"A"},{name:"Ying Cracker",score:95,grade:"A"}]},{title:"Data Structures",instructor:"Brodal Q.",students:[{name:"Ada Lovelace",score:88,grade:"B"},{name:"Albert Gonzalez",score:56,grade:"F"},{name:"Brian Kernaghan",score:58,grade:"F"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:85,grade:"B"},{name:"Grace Hopper",score:53,grade:"F"},{name:"Hack Kerr",score:89,grade:"B"},{name:"James Gosling",score:42,grade:"F"},{name:"Ken Thompson",score:87,grade:"B"},{name:"Kevin Mitnick",score:40,grade:"F"},{name:"Linus Torvalds",score:91,grade:"A"},{name:"Niklaus Wirth",score:51,grade:"F"},{name:"Rebecca Heineman",score:79,grade:"C"},{name:"Tim Berners-Lee",score:37,grade:"F"},{name:"Xiao Tian",score:84,grade:"B"},{name:"Ying Cracker",score:45,grade:"F"}]},{title:"Networks",instructor:"Van Emde Boas",students:[{name:"Ada Lovelace",score:65,grade:"D"},{name:"Albert Gonzalez",score:52,grade:"F"},{name:"Brian Kernaghan",score:61,grade:"D"},{name:"Danielle Bunten Berry",score:59,grade:"F"},{name:"Donald Knuth",score:89,grade:"B"},{name:"Grace Hopper",score:40,grade:"F"},{name:"Hack Kerr",score:102,grade:"F"},{name:"James Gosling",score:39,grade:"F"},{name:"Ken Thompson",score:83,grade:"B"},{name:"Kevin Mitnick",score:37,grade:"F"},{name:"Linus Torvalds",score:65,grade:"D"},{name:"Niklaus Wirth",score:36,grade:"F"},{name:"Rebecca Heineman",score:32,grade:"F"},{name:"Tim Berners-Lee",score:70,grade:"C"},{name:"Xiao Tian",score:52,grade:"F"},{name:"Ying Cracker",score:62,grade:"D"}]}]; diff --git a/tutorial/data/courses2.js b/tutorial/data/courses2.js index 7669fd6..6b92a94 100644 --- a/tutorial/data/courses2.js +++ b/tutorial/data/courses2.js @@ -1,12 +1 @@ -var courses = [ -{ "title": "Relational Databases", "instructor": "Sean Quentin Lewis", "students": [{ "name": "!f", "score": 61, "grade": "D" },{ "name": "Albert Gonzalez", "score": 35, "grade": "F" },{ "name": "Brian Kernaghan", "score": 35, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 78, "grade": "C" },{ "name": "Donald Knuth", "score": 94, "grade": "A" },{ "name": "Grace Hopper", "score": 36, "grade": "F" },{ "name": "Hack Kerr", "score": 85, "grade": "F" },{ "name": "James Gosling", "score": 30, "grade": "F" },{ "name": "Ken Thompson", "score": 30, "grade": "F" },{ "name": "Kevin Mitnick", "score": 72, "grade": "C" },{ "name": "Linus Torvalds", "score": 34, "grade": "F" },{ "name": "Niklaus Wirth", "score": 75, "grade": "C" },{ "name": "Rebecca Heineman", "score": 71, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 54, "grade": "F" },{ "name": "Xiao Tian", "score": 67, "grade": "D" },{ "name": "Ying Cracker", "score": 57, "grade": "F" }] }, -{ "title": "3D Computer Graphics", "instructor": "G.L. Webb", "students": [{ "name": "in", "score": 58, "grade": "F" },{ "name": "Albert Gonzalez", "score": 37, "grade": "F" },{ "name": "Brian Kernaghan", "score": 76, "grade": "C" },{ "name": "Danielle Bunten Berry", "score": 53, "grade": "F" },{ "name": "Donald Knuth", "score": 34, "grade": "F" },{ "name": "Grace Hopper", "score": 74, "grade": "C" },{ "name": "Hack Kerr", "score": 86, "grade": "F" },{ "name": "James Gosling", "score": 94, "grade": "A" },{ "name": "Ken Thompson", "score": 48, "grade": "F" },{ "name": "Kevin Mitnick", "score": 52, "grade": "F" },{ "name": "Linus Torvalds", "score": 90, "grade": "A" },{ "name": "Niklaus Wirth", "score": 78, "grade": "C" },{ "name": "Rebecca Heineman", "score": 73, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 94, "grade": "A" },{ "name": "Xiao Tian", "score": 45, "grade": "F" },{ "name": "Ying Cracker", "score": 77, "grade": "C" }] }, -{ "title": "Front End Web Development", "instructor": "Moe Zaick", "students": [{ "name": "dt", "score": 31, "grade": "F" },{ "name": "Albert Gonzalez", "score": 73, "grade": "C" },{ "name": "Brian Kernaghan", "score": 47, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 87, "grade": "B" },{ "name": "Donald Knuth", "score": 80, "grade": "B" },{ "name": "Grace Hopper", "score": 80, "grade": "B" },{ "name": "Hack Kerr", "score": 92, "grade": "C" },{ "name": "James Gosling", "score": 97, "grade": "A" },{ "name": "Ken Thompson", "score": 64, "grade": "D" },{ "name": "Kevin Mitnick", "score": 47, "grade": "F" },{ "name": "Linus Torvalds", "score": 58, "grade": "F" },{ "name": "Niklaus Wirth", "score": 93, "grade": "A" },{ "name": "Rebecca Heineman", "score": 58, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 98, "grade": "A" },{ "name": "Xiao Tian", "score": 36, "grade": "F" },{ "name": "Ying Cracker", "score": 73, "grade": "C" }] }, -{ "title": "Web Security", "instructor": "Sue Denim", "students": [{ "name": "he", "score": 51, "grade": "F" },{ "name": "Albert Gonzalez", "score": 74, "grade": "C" },{ "name": "Brian Kernaghan", "score": 92, "grade": "A" },{ "name": "Danielle Bunten Berry", "score": 34, "grade": "F" },{ "name": "Donald Knuth", "score": 44, "grade": "F" },{ "name": "Grace Hopper", "score": 81, "grade": "B" },{ "name": "Hack Kerr", "score": 75, "grade": "F" },{ "name": "James Gosling", "score": 95, "grade": "A" },{ "name": "Ken Thompson", "score": 84, "grade": "B" },{ "name": "Kevin Mitnick", "score": 89, "grade": "B" },{ "name": "Linus Torvalds", "score": 57, "grade": "F" },{ "name": "Niklaus Wirth", "score": 88, "grade": "B" },{ "name": "Rebecca Heineman", "score": 93, "grade": "A" },{ "name": "Tim Berners-Lee", "score": 36, "grade": "F" },{ "name": "Xiao Tian", "score": 87, "grade": "B" },{ "name": "Ying Cracker", "score": 42, "grade": "F" }] }, -{ "title": "Javascript Fundamentals", "instructor": "Jay Kweerie", "students": [{ "name": "be", "score": 43, "grade": "F" },{ "name": "Albert Gonzalez", "score": 94, "grade": "A" },{ "name": "Brian Kernaghan", "score": 71, "grade": "C" },{ "name": "Danielle Bunten Berry", "score": 66, "grade": "D" },{ "name": "Donald Knuth", "score": 94, "grade": "A" },{ "name": "Grace Hopper", "score": 99, "grade": "A" },{ "name": "Hack Kerr", "score": 83, "grade": "F" },{ "name": "James Gosling", "score": 99, "grade": "A" },{ "name": "Ken Thompson", "score": 65, "grade": "D" },{ "name": "Kevin Mitnick", "score": 47, "grade": "F" },{ "name": "Linus Torvalds", "score": 93, "grade": "A" },{ "name": "Niklaus Wirth", "score": 50, "grade": "F" },{ "name": "Rebecca Heineman", "score": 33, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 51, "grade": "F" },{ "name": "Xiao Tian", "score": 87, "grade": "B" },{ "name": "Ying Cracker", "score": 60, "grade": "D" }] }, -{ "title": "Data Science", "instructor": "Ford Fulkerson", "students": [{ "name": "st", "score": 28, "grade": "F" },{ "name": "Albert Gonzalez", "score": 67, "grade": "D" },{ "name": "Brian Kernaghan", "score": 66, "grade": "D" },{ "name": "Danielle Bunten Berry", "score": 36, "grade": "F" },{ "name": "Donald Knuth", "score": 36, "grade": "F" },{ "name": "Grace Hopper", "score": 66, "grade": "D" },{ "name": "Hack Kerr", "score": 96, "grade": "A" },{ "name": "James Gosling", "score": 83, "grade": "B" },{ "name": "Ken Thompson", "score": 35, "grade": "F" },{ "name": "Kevin Mitnick", "score": 75, "grade": "C" },{ "name": "Linus Torvalds", "score": 63, "grade": "D" },{ "name": "Niklaus Wirth", "score": 75, "grade": "C" },{ "name": "Rebecca Heineman", "score": 84, "grade": "B" },{ "name": "Tim Berners-Lee", "score": 41, "grade": "F" },{ "name": "Xiao Tian", "score": 49, "grade": "F" },{ "name": "Ying Cracker", "score": 96, "grade": "A" }] }, -{ "title": "Algorithm Design", "instructor": "Gale Shapely", "students": [{ "name": "re", "score": 63, "grade": "D" },{ "name": "Albert Gonzalez", "score": 39, "grade": "F" },{ "name": "Brian Kernaghan", "score": 69, "grade": "D" },{ "name": "Danielle Bunten Berry", "score": 54, "grade": "F" },{ "name": "Donald Knuth", "score": 83, "grade": "B" },{ "name": "Grace Hopper", "score": 31, "grade": "F" },{ "name": "Hack Kerr", "score": 94, "grade": "A" },{ "name": "James Gosling", "score": 35, "grade": "F" },{ "name": "Ken Thompson", "score": 67, "grade": "D" },{ "name": "Kevin Mitnick", "score": 81, "grade": "B" },{ "name": "Linus Torvalds", "score": 70, "grade": "C" },{ "name": "Niklaus Wirth", "score": 74, "grade": "C" },{ "name": "Rebecca Heineman", "score": 92, "grade": "A" },{ "name": "Tim Berners-Lee", "score": 48, "grade": "F" },{ "name": "Xiao Tian", "score": 80, "grade": "B" },{ "name": "Ying Cracker", "score": 84, "grade": "B" }] }, -{ "title": "Data Abstraction", "instructor": "Aster Ricks", "students": [{ "name": "ve", "score": 52, "grade": "F" },{ "name": "Albert Gonzalez", "score": 70, "grade": "C" },{ "name": "Brian Kernaghan", "score": 89, "grade": "B" },{ "name": "Danielle Bunten Berry", "score": 38, "grade": "F" },{ "name": "Donald Knuth", "score": 86, "grade": "B" },{ "name": "Grace Hopper", "score": 42, "grade": "F" },{ "name": "Hack Kerr", "score": 87, "grade": "F" },{ "name": "James Gosling", "score": 89, "grade": "B" },{ "name": "Ken Thompson", "score": 86, "grade": "B" },{ "name": "Kevin Mitnick", "score": 41, "grade": "F" },{ "name": "Linus Torvalds", "score": 76, "grade": "C" },{ "name": "Niklaus Wirth", "score": 78, "grade": "C" },{ "name": "Rebecca Heineman", "score": 70, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 74, "grade": "C" },{ "name": "Xiao Tian", "score": 93, "grade": "A" },{ "name": "Ying Cracker", "score": 95, "grade": "A" }] }, -{ "title": "Data Structures", "instructor": "Brodal Q.", "students": [{ "name": "ng", "score": 58, "grade": "F" },{ "name": "Albert Gonzalez", "score": 56, "grade": "F" },{ "name": "Brian Kernaghan", "score": 58, "grade": "F" },{ "name": "Danielle Bunten Berry", "score": 38, "grade": "F" },{ "name": "Donald Knuth", "score": 85, "grade": "B" },{ "name": "Grace Hopper", "score": 53, "grade": "F" },{ "name": "Hack Kerr", "score": 89, "grade": "B" },{ "name": "James Gosling", "score": 42, "grade": "F" },{ "name": "Ken Thompson", "score": 87, "grade": "B" },{ "name": "Kevin Mitnick", "score": 40, "grade": "F" },{ "name": "Linus Torvalds", "score": 91, "grade": "A" },{ "name": "Niklaus Wirth", "score": 51, "grade": "F" },{ "name": "Rebecca Heineman", "score": 79, "grade": "C" },{ "name": "Tim Berners-Lee", "score": 37, "grade": "F" },{ "name": "Xiao Tian", "score": 84, "grade": "B" },{ "name": "Ying Cracker", "score": 45, "grade": "F" }] }, -{ "title": "Networks", "instructor": "Van Emde Boas", "students": [{ "name": "e!", "score": 35, "grade": "F" },{ "name": "Albert Gonzalez", "score": 52, "grade": "F" },{ "name": "Brian Kernaghan", "score": 61, "grade": "D" },{ "name": "Danielle Bunten Berry", "score": 59, "grade": "F" },{ "name": "Donald Knuth", "score": 89, "grade": "B" },{ "name": "Grace Hopper", "score": 40, "grade": "F" },{ "name": "Hack Kerr", "score": 102, "grade": "F" },{ "name": "James Gosling", "score": 39, "grade": "F" },{ "name": "Ken Thompson", "score": 83, "grade": "B" },{ "name": "Kevin Mitnick", "score": 37, "grade": "F" },{ "name": "Linus Torvalds", "score": 65, "grade": "D" },{ "name": "Niklaus Wirth", "score": 36, "grade": "F" },{ "name": "Rebecca Heineman", "score": 32, "grade": "F" },{ "name": "Tim Berners-Lee", "score": 70, "grade": "C" },{ "name": "Xiao Tian", "score": 52, "grade": "F" },{ "name": "Ying Cracker", "score": 62, "grade": "D" }] } -] +var courses=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",students:[{name:"!f",score:61,grade:"D"},{name:"Albert Gonzalez",score:35,grade:"F"},{name:"Brian Kernaghan",score:35,grade:"F"},{name:"Danielle Bunten Berry",score:78,grade:"C"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:36,grade:"F"},{name:"Hack Kerr",score:85,grade:"F"},{name:"James Gosling",score:30,grade:"F"},{name:"Ken Thompson",score:30,grade:"F"},{name:"Kevin Mitnick",score:72,grade:"C"},{name:"Linus Torvalds",score:34,grade:"F"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:71,grade:"C"},{name:"Tim Berners-Lee",score:54,grade:"F"},{name:"Xiao Tian",score:67,grade:"D"},{name:"Ying Cracker",score:57,grade:"F"}]},{title:"3D Computer Graphics",instructor:"G.L. Webb",students:[{name:"in",score:58,grade:"F"},{name:"Albert Gonzalez",score:37,grade:"F"},{name:"Brian Kernaghan",score:76,grade:"C"},{name:"Danielle Bunten Berry",score:53,grade:"F"},{name:"Donald Knuth",score:34,grade:"F"},{name:"Grace Hopper",score:74,grade:"C"},{name:"Hack Kerr",score:86,grade:"F"},{name:"James Gosling",score:94,grade:"A"},{name:"Ken Thompson",score:48,grade:"F"},{name:"Kevin Mitnick",score:52,grade:"F"},{name:"Linus Torvalds",score:90,grade:"A"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:73,grade:"C"},{name:"Tim Berners-Lee",score:94,grade:"A"},{name:"Xiao Tian",score:45,grade:"F"},{name:"Ying Cracker",score:77,grade:"C"}]},{title:"Front End Web Development",instructor:"Moe Zaick",students:[{name:"dt",score:31,grade:"F"},{name:"Albert Gonzalez",score:73,grade:"C"},{name:"Brian Kernaghan",score:47,grade:"F"},{name:"Danielle Bunten Berry",score:87,grade:"B"},{name:"Donald Knuth",score:80,grade:"B"},{name:"Grace Hopper",score:80,grade:"B"},{name:"Hack Kerr",score:92,grade:"C"},{name:"James Gosling",score:97,grade:"A"},{name:"Ken Thompson",score:64,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:58,grade:"F"},{name:"Niklaus Wirth",score:93,grade:"A"},{name:"Rebecca Heineman",score:58,grade:"F"},{name:"Tim Berners-Lee",score:98,grade:"A"},{name:"Xiao Tian",score:36,grade:"F"},{name:"Ying Cracker",score:73,grade:"C"}]},{title:"Web Security",instructor:"Sue Denim",students:[{name:"he",score:51,grade:"F"},{name:"Albert Gonzalez",score:74,grade:"C"},{name:"Brian Kernaghan",score:92,grade:"A"},{name:"Danielle Bunten Berry",score:34,grade:"F"},{name:"Donald Knuth",score:44,grade:"F"},{name:"Grace Hopper",score:81,grade:"B"},{name:"Hack Kerr",score:75,grade:"F"},{name:"James Gosling",score:95,grade:"A"},{name:"Ken Thompson",score:84,grade:"B"},{name:"Kevin Mitnick",score:89,grade:"B"},{name:"Linus Torvalds",score:57,grade:"F"},{name:"Niklaus Wirth",score:88,grade:"B"},{name:"Rebecca Heineman",score:93,grade:"A"},{name:"Tim Berners-Lee",score:36,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:42,grade:"F"}]},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",students:[{name:"be",score:43,grade:"F"},{name:"Albert Gonzalez",score:94,grade:"A"},{name:"Brian Kernaghan",score:71,grade:"C"},{name:"Danielle Bunten Berry",score:66,grade:"D"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:99,grade:"A"},{name:"Hack Kerr",score:83,grade:"F"},{name:"James Gosling",score:99,grade:"A"},{name:"Ken Thompson",score:65,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:93,grade:"A"},{name:"Niklaus Wirth",score:50,grade:"F"},{name:"Rebecca Heineman",score:33,grade:"F"},{name:"Tim Berners-Lee",score:51,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:60,grade:"D"}]},{title:"Data Science",instructor:"Ford Fulkerson",students:[{name:"st",score:28,grade:"F"},{name:"Albert Gonzalez",score:67,grade:"D"},{name:"Brian Kernaghan",score:66,grade:"D"},{name:"Danielle Bunten Berry",score:36,grade:"F"},{name:"Donald Knuth",score:36,grade:"F"},{name:"Grace Hopper",score:66,grade:"D"},{name:"Hack Kerr",score:96,grade:"A"},{name:"James Gosling",score:83,grade:"B"},{name:"Ken Thompson",score:35,grade:"F"},{name:"Kevin Mitnick",score:75,grade:"C"},{name:"Linus Torvalds",score:63,grade:"D"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:84,grade:"B"},{name:"Tim Berners-Lee",score:41,grade:"F"},{name:"Xiao Tian",score:49,grade:"F"},{name:"Ying Cracker",score:96,grade:"A"}]},{title:"Algorithm Design",instructor:"Gale Shapely",students:[{name:"re",score:63,grade:"D"},{name:"Albert Gonzalez",score:39,grade:"F"},{name:"Brian Kernaghan",score:69,grade:"D"},{name:"Danielle Bunten Berry",score:54,grade:"F"},{name:"Donald Knuth",score:83,grade:"B"},{name:"Grace Hopper",score:31,grade:"F"},{name:"Hack Kerr",score:94,grade:"A"},{name:"James Gosling",score:35,grade:"F"},{name:"Ken Thompson",score:67,grade:"D"},{name:"Kevin Mitnick",score:81,grade:"B"},{name:"Linus Torvalds",score:70,grade:"C"},{name:"Niklaus Wirth",score:74,grade:"C"},{name:"Rebecca Heineman",score:92,grade:"A"},{name:"Tim Berners-Lee",score:48,grade:"F"},{name:"Xiao Tian",score:80,grade:"B"},{name:"Ying Cracker",score:84,grade:"B"}]},{title:"Data Abstraction",instructor:"Aster Ricks",students:[{name:"ve",score:52,grade:"F"},{name:"Albert Gonzalez",score:70,grade:"C"},{name:"Brian Kernaghan",score:89,grade:"B"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:86,grade:"B"},{name:"Grace Hopper",score:42,grade:"F"},{name:"Hack Kerr",score:87,grade:"F"},{name:"James Gosling",score:89,grade:"B"},{name:"Ken Thompson",score:86,grade:"B"},{name:"Kevin Mitnick",score:41,grade:"F"},{name:"Linus Torvalds",score:76,grade:"C"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:70,grade:"C"},{name:"Tim Berners-Lee",score:74,grade:"C"},{name:"Xiao Tian",score:93,grade:"A"},{name:"Ying Cracker",score:95,grade:"A"}]},{title:"Data Structures",instructor:"Brodal Q.",students:[{name:"ng",score:58,grade:"F"},{name:"Albert Gonzalez",score:56,grade:"F"},{name:"Brian Kernaghan",score:58,grade:"F"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:85,grade:"B"},{name:"Grace Hopper",score:53,grade:"F"},{name:"Hack Kerr",score:89,grade:"B"},{name:"James Gosling",score:42,grade:"F"},{name:"Ken Thompson",score:87,grade:"B"},{name:"Kevin Mitnick",score:40,grade:"F"},{name:"Linus Torvalds",score:91,grade:"A"},{name:"Niklaus Wirth",score:51,grade:"F"},{name:"Rebecca Heineman",score:79,grade:"C"},{name:"Tim Berners-Lee",score:37,grade:"F"},{name:"Xiao Tian",score:84,grade:"B"},{name:"Ying Cracker",score:45,grade:"F"}]},{title:"Networks",instructor:"Van Emde Boas",students:[{name:"e!",score:35,grade:"F"},{name:"Albert Gonzalez",score:52,grade:"F"},{name:"Brian Kernaghan",score:61,grade:"D"},{name:"Danielle Bunten Berry",score:59,grade:"F"},{name:"Donald Knuth",score:89,grade:"B"},{name:"Grace Hopper",score:40,grade:"F"},{name:"Hack Kerr",score:102,grade:"F"},{name:"James Gosling",score:39,grade:"F"},{name:"Ken Thompson",score:83,grade:"B"},{name:"Kevin Mitnick",score:37,grade:"F"},{name:"Linus Torvalds",score:65,grade:"D"},{name:"Niklaus Wirth",score:36,grade:"F"},{name:"Rebecca Heineman",score:32,grade:"F"},{name:"Tim Berners-Lee",score:70,grade:"C"},{name:"Xiao Tian",score:52,grade:"F"},{name:"Ying Cracker",score:62,grade:"D"}]}]; diff --git a/tutorial/data/students.js b/tutorial/data/students.js index 964a241..8565659 100644 --- a/tutorial/data/students.js +++ b/tutorial/data/students.js @@ -1,961 +1 @@ -var students = [{ - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Albert Gonzalez", - "score": 35, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Brian Kernaghan", - "score": 35, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Danielle Bunten Berry", - "score": 78, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Donald Knuth", - "score": 94, - "grade": "A" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Grace Hopper", - "score": 36, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Hack Kerr", - "score": 85, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "James Gosling", - "score": 30, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ken Thompson", - "score": 30, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Kevin Mitnick", - "score": 72, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Linus Torvalds", - "score": 34, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Niklaus Wirth", - "score": 75, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Rebecca Heineman", - "score": 71, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Tim Berners-Lee", - "score": 54, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Xiao Tian", - "score": 67, - "grade": "D" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ying Cracker", - "score": 57, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ada Lovelace", - "score": 88, - "grade": "B" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Albert Gonzalez", - "score": 37, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Brian Kernaghan", - "score": 76, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Danielle Bunten Berry", - "score": 53, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Donald Knuth", - "score": 34, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Grace Hopper", - "score": 74, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Hack Kerr", - "score": 86, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "James Gosling", - "score": 94, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ken Thompson", - "score": 48, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Kevin Mitnick", - "score": 52, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Linus Torvalds", - "score": 90, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Niklaus Wirth", - "score": 78, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Rebecca Heineman", - "score": 73, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Tim Berners-Lee", - "score": 94, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Xiao Tian", - "score": 45, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ying Cracker", - "score": 77, - "grade": "C" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ada Lovelace", - "score": 61, - "grade": "D" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Albert Gonzalez", - "score": 73, - "grade": "C" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Brian Kernaghan", - "score": 47, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Danielle Bunten Berry", - "score": 87, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Donald Knuth", - "score": 80, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Grace Hopper", - "score": 80, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Hack Kerr", - "score": 92, - "grade": "C" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "James Gosling", - "score": 97, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ken Thompson", - "score": 64, - "grade": "D" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Kevin Mitnick", - "score": 47, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Linus Torvalds", - "score": 58, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Niklaus Wirth", - "score": 93, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Rebecca Heineman", - "score": 58, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Tim Berners-Lee", - "score": 98, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Xiao Tian", - "score": 36, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ying Cracker", - "score": 73, - "grade": "C" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ada Lovelace", - "score": 81, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Albert Gonzalez", - "score": 74, - "grade": "C" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Brian Kernaghan", - "score": 92, - "grade": "A" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Danielle Bunten Berry", - "score": 34, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Donald Knuth", - "score": 44, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Grace Hopper", - "score": 81, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Hack Kerr", - "score": 75, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "James Gosling", - "score": 95, - "grade": "A" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ken Thompson", - "score": 84, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Kevin Mitnick", - "score": 89, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Linus Torvalds", - "score": 57, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Niklaus Wirth", - "score": 88, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Rebecca Heineman", - "score": 93, - "grade": "A" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Tim Berners-Lee", - "score": 36, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Xiao Tian", - "score": 87, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ying Cracker", - "score": 42, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ada Lovelace", - "score": 73, - "grade": "C" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Albert Gonzalez", - "score": 94, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Brian Kernaghan", - "score": 71, - "grade": "C" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Danielle Bunten Berry", - "score": 66, - "grade": "D" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Donald Knuth", - "score": 94, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Grace Hopper", - "score": 99, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Hack Kerr", - "score": 83, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "James Gosling", - "score": 99, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ken Thompson", - "score": 65, - "grade": "D" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Kevin Mitnick", - "score": 47, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Linus Torvalds", - "score": 93, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Niklaus Wirth", - "score": 50, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Rebecca Heineman", - "score": 33, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Tim Berners-Lee", - "score": 51, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Xiao Tian", - "score": 87, - "grade": "B" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ying Cracker", - "score": 60, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ada Lovelace", - "score": 58, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Albert Gonzalez", - "score": 67, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Brian Kernaghan", - "score": 66, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Danielle Bunten Berry", - "score": 36, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Donald Knuth", - "score": 36, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Grace Hopper", - "score": 66, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Hack Kerr", - "score": 96, - "grade": "A" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "James Gosling", - "score": 83, - "grade": "B" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ken Thompson", - "score": 35, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Kevin Mitnick", - "score": 75, - "grade": "C" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Linus Torvalds", - "score": 63, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Niklaus Wirth", - "score": 75, - "grade": "C" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Rebecca Heineman", - "score": 84, - "grade": "B" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Tim Berners-Lee", - "score": 41, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Xiao Tian", - "score": 49, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ying Cracker", - "score": 96, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ada Lovelace", - "score": 93, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Albert Gonzalez", - "score": 39, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Brian Kernaghan", - "score": 69, - "grade": "D" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Danielle Bunten Berry", - "score": 54, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Donald Knuth", - "score": 83, - "grade": "B" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Grace Hopper", - "score": 31, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Hack Kerr", - "score": 94, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "James Gosling", - "score": 35, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ken Thompson", - "score": 67, - "grade": "D" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Kevin Mitnick", - "score": 81, - "grade": "B" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Linus Torvalds", - "score": 70, - "grade": "C" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Niklaus Wirth", - "score": 74, - "grade": "C" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Rebecca Heineman", - "score": 92, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Tim Berners-Lee", - "score": 48, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Xiao Tian", - "score": 80, - "grade": "B" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ying Cracker", - "score": 84, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ada Lovelace", - "score": 82, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Albert Gonzalez", - "score": 70, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Brian Kernaghan", - "score": 89, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Danielle Bunten Berry", - "score": 38, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Donald Knuth", - "score": 86, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Grace Hopper", - "score": 42, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Hack Kerr", - "score": 87, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "James Gosling", - "score": 89, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ken Thompson", - "score": 86, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Kevin Mitnick", - "score": 41, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Linus Torvalds", - "score": 76, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Niklaus Wirth", - "score": 78, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Rebecca Heineman", - "score": 70, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Tim Berners-Lee", - "score": 74, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Xiao Tian", - "score": 93, - "grade": "A" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ying Cracker", - "score": 95, - "grade": "A" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ada Lovelace", - "score": 88, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Albert Gonzalez", - "score": 56, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Brian Kernaghan", - "score": 58, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Danielle Bunten Berry", - "score": 38, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Donald Knuth", - "score": 85, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Grace Hopper", - "score": 53, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Hack Kerr", - "score": 89, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "James Gosling", - "score": 42, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ken Thompson", - "score": 87, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Kevin Mitnick", - "score": 40, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Linus Torvalds", - "score": 91, - "grade": "A" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Niklaus Wirth", - "score": 51, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Rebecca Heineman", - "score": 79, - "grade": "C" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Tim Berners-Lee", - "score": 37, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Xiao Tian", - "score": 84, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ying Cracker", - "score": 45, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ada Lovelace", - "score": 65, - "grade": "D" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Albert Gonzalez", - "score": 52, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Brian Kernaghan", - "score": 61, - "grade": "D" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Danielle Bunten Berry", - "score": 59, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Donald Knuth", - "score": 89, - "grade": "B" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Grace Hopper", - "score": 40, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Hack Kerr", - "score": 102, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "James Gosling", - "score": 39, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ken Thompson", - "score": 83, - "grade": "B" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Kevin Mitnick", - "score": 37, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Linus Torvalds", - "score": 65, - "grade": "D" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Niklaus Wirth", - "score": 36, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Rebecca Heineman", - "score": 32, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Tim Berners-Lee", - "score": 70, - "grade": "C" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Xiao Tian", - "score": 52, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ying Cracker", - "score": 62, - "grade": "D" -}] +var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; diff --git a/tutorial/data/students2.js b/tutorial/data/students2.js index 7981d9f..eb814fc 100644 --- a/tutorial/data/students2.js +++ b/tutorial/data/students2.js @@ -1,961 +1 @@ -var students = [{ - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "!f", - "score": 91, - "grade": "A" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Albert Gonzalez", - "score": 35, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Brian Kernaghan", - "score": 35, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Danielle Bunten Berry", - "score": 78, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Donald Knuth", - "score": 94, - "grade": "A" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Grace Hopper", - "score": 36, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Hack Kerr", - "score": 85, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "James Gosling", - "score": 30, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ken Thompson", - "score": 30, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Kevin Mitnick", - "score": 72, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Linus Torvalds", - "score": 34, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Niklaus Wirth", - "score": 75, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Rebecca Heineman", - "score": 71, - "grade": "C" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Tim Berners-Lee", - "score": 54, - "grade": "F" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Xiao Tian", - "score": 67, - "grade": "D" -}, { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ying Cracker", - "score": 57, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "in", - "score": 88, - "grade": "B" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Albert Gonzalez", - "score": 37, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Brian Kernaghan", - "score": 76, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Danielle Bunten Berry", - "score": 53, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Donald Knuth", - "score": 34, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Grace Hopper", - "score": 74, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Hack Kerr", - "score": 86, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "James Gosling", - "score": 94, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ken Thompson", - "score": 48, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Kevin Mitnick", - "score": 52, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Linus Torvalds", - "score": 90, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Niklaus Wirth", - "score": 78, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Rebecca Heineman", - "score": 73, - "grade": "C" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Tim Berners-Lee", - "score": 94, - "grade": "A" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Xiao Tian", - "score": 45, - "grade": "F" -}, { - "title": "3D Computer Graphics", - "instructor": "G.L. Webb", - "name": "Ying Cracker", - "score": 77, - "grade": "C" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "dt", - "score": 61, - "grade": "D" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Albert Gonzalez", - "score": 73, - "grade": "C" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Brian Kernaghan", - "score": 47, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Danielle Bunten Berry", - "score": 87, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Donald Knuth", - "score": 80, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Grace Hopper", - "score": 80, - "grade": "B" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Hack Kerr", - "score": 92, - "grade": "C" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "James Gosling", - "score": 97, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ken Thompson", - "score": 64, - "grade": "D" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Kevin Mitnick", - "score": 47, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Linus Torvalds", - "score": 58, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Niklaus Wirth", - "score": 93, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Rebecca Heineman", - "score": 58, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Tim Berners-Lee", - "score": 98, - "grade": "A" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Xiao Tian", - "score": 36, - "grade": "F" -}, { - "title": "Front End Web Development", - "instructor": "Moe Zaick", - "name": "Ying Cracker", - "score": 73, - "grade": "C" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Donald Knuth", - "score": 44, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Albert Gonzalez", - "score": 74, - "grade": "C" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Brian Kernaghan", - "score": 92, - "grade": "A" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Danielle Bunten Berry", - "score": 34, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "he", - "score": 81, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Grace Hopper", - "score": 81, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Hack Kerr", - "score": 75, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "James Gosling", - "score": 95, - "grade": "A" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ken Thompson", - "score": 84, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Kevin Mitnick", - "score": 89, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Linus Torvalds", - "score": 57, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Niklaus Wirth", - "score": 88, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Rebecca Heineman", - "score": 93, - "grade": "A" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Tim Berners-Lee", - "score": 36, - "grade": "F" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Xiao Tian", - "score": 87, - "grade": "B" -}, { - "title": "Web Security", - "instructor": "Sue Denim", - "name": "Ying Cracker", - "score": 42, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "be", - "score": 73, - "grade": "C" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Albert Gonzalez", - "score": 94, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Brian Kernaghan", - "score": 71, - "grade": "C" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Danielle Bunten Berry", - "score": 66, - "grade": "D" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Donald Knuth", - "score": 94, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Grace Hopper", - "score": 99, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Hack Kerr", - "score": 83, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "James Gosling", - "score": 99, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ken Thompson", - "score": 65, - "grade": "D" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Kevin Mitnick", - "score": 47, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Linus Torvalds", - "score": 93, - "grade": "A" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Niklaus Wirth", - "score": 50, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Rebecca Heineman", - "score": 33, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Tim Berners-Lee", - "score": 51, - "grade": "F" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Xiao Tian", - "score": 87, - "grade": "B" -}, { - "title": "Javascript Fundamentals", - "instructor": "Jay Kweerie", - "name": "Ying Cracker", - "score": 60, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "st", - "score": 58, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Albert Gonzalez", - "score": 67, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Brian Kernaghan", - "score": 66, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Danielle Bunten Berry", - "score": 36, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Donald Knuth", - "score": 36, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Grace Hopper", - "score": 66, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Hack Kerr", - "score": 96, - "grade": "A" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "James Gosling", - "score": 83, - "grade": "B" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ken Thompson", - "score": 35, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Kevin Mitnick", - "score": 75, - "grade": "C" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Linus Torvalds", - "score": 63, - "grade": "D" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Niklaus Wirth", - "score": 75, - "grade": "C" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Rebecca Heineman", - "score": 84, - "grade": "B" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Tim Berners-Lee", - "score": 41, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Xiao Tian", - "score": 49, - "grade": "F" -}, { - "title": "Data Science", - "instructor": "Ford Fulkerson", - "name": "Ying Cracker", - "score": 96, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "re", - "score": 93, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Albert Gonzalez", - "score": 39, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Brian Kernaghan", - "score": 69, - "grade": "D" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Danielle Bunten Berry", - "score": 54, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Donald Knuth", - "score": 83, - "grade": "B" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Grace Hopper", - "score": 31, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Hack Kerr", - "score": 94, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "James Gosling", - "score": 35, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ken Thompson", - "score": 67, - "grade": "D" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Kevin Mitnick", - "score": 81, - "grade": "B" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Linus Torvalds", - "score": 70, - "grade": "C" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Niklaus Wirth", - "score": 74, - "grade": "C" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Rebecca Heineman", - "score": 92, - "grade": "A" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Tim Berners-Lee", - "score": 48, - "grade": "F" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Xiao Tian", - "score": 80, - "grade": "B" -}, { - "title": "Algorithm Design", - "instructor": "Gale Shapely", - "name": "Ying Cracker", - "score": 84, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "ve", - "score": 82, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Albert Gonzalez", - "score": 70, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Brian Kernaghan", - "score": 89, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Danielle Bunten Berry", - "score": 38, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Donald Knuth", - "score": 86, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Grace Hopper", - "score": 42, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Hack Kerr", - "score": 87, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "James Gosling", - "score": 89, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ken Thompson", - "score": 86, - "grade": "B" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Kevin Mitnick", - "score": 41, - "grade": "F" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Linus Torvalds", - "score": 76, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Niklaus Wirth", - "score": 78, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Rebecca Heineman", - "score": 70, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Tim Berners-Lee", - "score": 74, - "grade": "C" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Xiao Tian", - "score": 93, - "grade": "A" -}, { - "title": "Data Abstraction", - "instructor": "Aster Ricks", - "name": "Ying Cracker", - "score": 95, - "grade": "A" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "ng", - "score": 88, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Albert Gonzalez", - "score": 56, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Brian Kernaghan", - "score": 58, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Danielle Bunten Berry", - "score": 38, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Donald Knuth", - "score": 85, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Grace Hopper", - "score": 53, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Hack Kerr", - "score": 89, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "James Gosling", - "score": 42, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ken Thompson", - "score": 87, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Kevin Mitnick", - "score": 40, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Linus Torvalds", - "score": 91, - "grade": "A" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Niklaus Wirth", - "score": 51, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Rebecca Heineman", - "score": 79, - "grade": "C" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Tim Berners-Lee", - "score": 37, - "grade": "F" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Xiao Tian", - "score": 84, - "grade": "B" -}, { - "title": "Data Structures", - "instructor": "Brodal Q.", - "name": "Ying Cracker", - "score": 45, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "e!", - "score": 65, - "grade": "D" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Albert Gonzalez", - "score": 52, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Brian Kernaghan", - "score": 61, - "grade": "D" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Danielle Bunten Berry", - "score": 59, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Donald Knuth", - "score": 89, - "grade": "B" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Grace Hopper", - "score": 40, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Hack Kerr", - "score": 102, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "James Gosling", - "score": 39, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ken Thompson", - "score": 83, - "grade": "B" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Kevin Mitnick", - "score": 37, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Linus Torvalds", - "score": 65, - "grade": "D" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Niklaus Wirth", - "score": 36, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Rebecca Heineman", - "score": 32, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Tim Berners-Lee", - "score": 70, - "grade": "C" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Xiao Tian", - "score": 52, - "grade": "F" -}, { - "title": "Networks", - "instructor": "Van Emde Boas", - "name": "Ying Cracker", - "score": 62, - "grade": "D" -}] +var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"!f",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"in",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"dt",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"he",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"be",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"st",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"re",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"ve",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"ng",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"e!",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; From 116e470641635f6bb778e40ba97133bf62b255f9 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Fri, 1 Apr 2016 15:33:34 -0700 Subject: [PATCH 14/46] rebuild coderoad.json --- README.md | 6 +++--- coderoad.json | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index eb7d0ad..a05ea49 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Understanding the Data Set Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. ```json -var data = [ +var students = [ { "title": "Relational Databases", "instructor": "Sean Quentin Lewis", @@ -52,7 +52,7 @@ Here we have an array of "student" objects. To get the first item in the array, ```js console.log( - 'first instructor', data[0].instructor + 'first instructor', students[0].instructor ); // first instructor Sean Quentin Lewis ``` @@ -103,7 +103,7 @@ Where were we? Back to filtering our grades. There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: ``` -console.log(data[0]); +console.log(students[0]); //> { course: 'Web Security', // instructor: 'Sue Denim', // name: 'Rebecca Heineman', diff --git a/coderoad.json b/coderoad.json index e725dad..add7407 100644 --- a/coderoad.json +++ b/coderoad.json @@ -10,10 +10,10 @@ "pages": [ { "title": "Start", - "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar data = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', data[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", + "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", "tasks": [ { - "description": "Set `first` to the first item in the `data` array.", + "description": "Set `first` to the first item in the `students` array.", "tests": [ "1/00/01-setup" ], @@ -22,8 +22,8 @@ "set('// Welcome to CodeRoad!\n\nvar first = ::>\n')" ], "hints": [ - "Get the first item in data using the array index", - "Access the title of `data[0]`" + "Get the first item in students using the array index", + "Access the title of `students[0]`" ] }, { @@ -35,7 +35,7 @@ "insert('var myName= ::>\n')" ], "hints": [ - "Get the first \"name\" in the data using the array index", + "Get the first \"name\" in the students using the array index", "Access the \"name\" of `first`", "Try `first.name`" ] @@ -58,7 +58,7 @@ }, { "title": "Filter", - "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(data[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", + "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", "tasks": [ { "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", @@ -81,7 +81,7 @@ "1/01/02-filter" ], "actions": [ - "insert('// run the function name in filter\nvar myData = data.filter(::>);\n')" + "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" ], "hints": [ "Add a function to the `filter` call: `Array.filter(function() {})`", @@ -304,7 +304,7 @@ "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nvar data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", "tasks": [ { - "description": "`filter` to students in the class titled \"Web Security\"", + "description": "`filter` to `students` in the class titled \"Web Security\"", "tests": [ "1/05/01-find" ], From ff7c5330ed3fd27d249acd10741721061444fae7 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Fri, 1 Apr 2016 16:11:48 -0700 Subject: [PATCH 15/46] drop lodash dependency --- CHANGELOG.md | 3 +++ package.json | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e29673b..515aff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.0] - 2016-04-01 +- update tutorial for changes to loaders in Atom-CodeRoad + ## [0.1.7] - 2016-02-26 - Hints for steps 1-7 diff --git a/package.json b/package.json index b7014cb..4497b85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.2.2", + "version": "0.3.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -27,7 +27,6 @@ "dependencies": { "chai": "3.5.0", "chai-spies": "0.7.1", - "lodash": "4.6.1", "mocha": "2.4.5", "mocha-coderoad": "^0.5.3" }, From 94660a0481de6bf724a23315d36bcaf90a4ce513 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Sat, 23 Apr 2016 18:52:38 -0700 Subject: [PATCH 16/46] updated for atom-coderoad@0.7 --- CHANGELOG.md | 3 +++ coderoad.json | 2 +- package.json | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 515aff1..80c2259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.4.0] - 2016-04-23 +- updated for atom-coderoad@0.7 + ## [0.3.0] - 2016-04-01 - update tutorial for changes to loaders in Atom-CodeRoad diff --git a/coderoad.json b/coderoad.json index add7407..593443a 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,5 +1,5 @@ { - "project": { + "info": { "title": "Functional School", "description": "A trip through functional programming in Javascript.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours" }, diff --git a/package.json b/package.json index 4497b85..2a4d026 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.3.0", + "version": "0.4.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -32,9 +32,9 @@ }, "license": "MIT", "config": { - "testDir": "tutorial", + "dir": "tutorial", "testSuffix": ".spec.js", - "testRunner": "mocha-coderoad", + "runner": "mocha-coderoad", "edit": true } } From fb4526b3aee6f99a8028eee2f7b4a58f5baed0c7 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 2 May 2016 10:29:40 -0700 Subject: [PATCH 17/46] updated for atom-coderoad v0.9 --- CHANGELOG.md | 3 + README.md | 10 +- coderoad.json | 1002 ++++++++++++++++---------------- tutorial/1/00/01-setup.spec.js | 40 +- tutorial/1/00/setup.md | 2 +- tutorial/1/01/filter.md | 2 +- tutorial/1/02/sort.md | 2 +- tutorial/1/03/map.md | 2 +- tutorial/1/04/forEach.md | 2 +- tutorial/1/05/find.md | 2 +- tutorial/1/06/concat.md | 2 +- tutorial/1/07/reduce.md | 2 +- tutorial/1/08/challenge-1.md | 2 +- tutorial/1/09/challenge-2.md | 2 +- tutorial/tutorial.md | 28 +- 15 files changed, 547 insertions(+), 556 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80c2259..e6f70f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.5.0] - 2016-05-02 +- remove "chapters" + ## [0.4.0] - 2016-04-23 - updated for atom-coderoad@0.7 diff --git a/README.md b/README.md index a05ea49..4494c27 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Functional School -A trip through functional programming in Javascript. +A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`. + +By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. Level: Intermediate Keywords: javascript, functional @@ -23,12 +25,6 @@ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. L ## Outline -### Array Methods - -Using common built-in Javascript array methods such as `map` & `reduce`. - -By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. - ##### Start Understanding the Data Set diff --git a/coderoad.json b/coderoad.json index 593443a..1fad1d1 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,533 +1,527 @@ { "info": { "title": "Functional School", - "description": "A trip through functional programming in Javascript.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours" + "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours" }, - "chapters": [ + "pages": [ { - "title": "Array Methods", - "description": "Using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.", - "pages": [ - { - "title": "Start", - "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", - "tasks": [ - { - "description": "Set `first` to the first item in the `students` array.", - "tests": [ - "1/00/01-setup" - ], - "actions": [ - "open('00-setup.js')", - "set('// Welcome to CodeRoad!\n\nvar first = ::>\n')" - ], - "hints": [ - "Get the first item in students using the array index", - "Access the title of `students[0]`" - ] - }, - { - "description": "Set `myName` to the \"name\" of the first student in the list.", - "tests": [ - "1/00/02-setup" - ], - "actions": [ - "insert('var myName= ::>\n')" - ], - "hints": [ - "Get the first \"name\" in the students using the array index", - "Access the \"name\" of `first`", - "Try `first.name`" - ] - }, - { - "description": "Log your name to the console.", - "tests": [ - "1/00/03-setup" - ], - "actions": [ - "insert('\nconsole.log(::>);\n')" - ], - "hints": [ - "Use `console.log`", - "Use `console.log(myName)`" - ] - } - ], - "onPageComplete": "Now we're ready to get started with `filter`ing our data." + "title": "Start", + "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", + "tasks": [ + { + "description": "Set `first` to the first item in the `students` array.", + "tests": [ + "1/00/01-setup" + ], + "actions": [ + "open('00-setup.js')", + "set('// Welcome to CodeRoad!\n\nvar first = ::>\n')" + ], + "hints": [ + "Get the first item in students using the array index", + "Access the title of `students[0]`" + ] + }, + { + "description": "Set `myName` to the \"name\" of the first student in the list.", + "tests": [ + "1/00/02-setup" + ], + "actions": [ + "insert('var myName= ::>\n')" + ], + "hints": [ + "Get the first \"name\" in the students using the array index", + "Access the \"name\" of `first`", + "Try `first.name`" + ] + }, + { + "description": "Log your name to the console.", + "tests": [ + "1/00/03-setup" + ], + "actions": [ + "insert('\nconsole.log(::>);\n')" + ], + "hints": [ + "Use `console.log`", + "Use `console.log(myName)`" + ] + } + ], + "onPageComplete": "Now we're ready to get started with `filter`ing our data." + }, + { + "title": "Filter", + "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", + "tasks": [ + { + "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", + "tests": [ + "1/01/01-filter" + ], + "actions": [ + "open('01-filter.js')", + "insert('// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" + ], + "hints": [ + "Some tasks have hints", + "Check if `student.name` matches \"Ada Lovelace\"", + "Use `===` to check equality" + ] + }, + { + "description": "Set `var myData` to filter with the `isAda` function.", + "tests": [ + "1/01/02-filter" + ], + "actions": [ + "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" + ], + "hints": [ + "Add a function to the `filter` call: `Array.filter(function() {})`", + "Pass `isAda` into your `filter` call" + ] + }, + { + "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", + "tests": [ + "1/01/03-filter" + ], + "actions": [ + "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" + ], + "hints": [ + "match for `student.grade` that isn't \"D\" or \"F\"", + "use `!==` to check non-equality", + "Match for both: `student.grade !== \"D\" && student.grade !== \"F\"`" + ] + }, + { + "description": "Set `var myBest` to your scores, excluding any grades that are \"D\" or \"F\".", + "tests": [ + "1/01/04-filter" + ], + "actions": [ + "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter(::>);\n\n')" + ] + } + ], + "onPageComplete": "In the next step we'll look at how to `sort` data" + }, + { + "title": "Sort", + "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", + "tasks": [ + { + "description": "`compareScore` should return 1 if the first score is less than the second", + "tests": [ + "1/02/01-sort" + ], + "actions": [ + "open('02-sort.js')", + "set('// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + ] + }, + { + "description": "`compareScore` should return -1 if the first score is more than the second", + "tests": [ + "1/02/02-sort" + ], + "hints": [ + "set the second case to `b.score < a.score`" + ] + }, + { + "description": "`compareScore` should return 0 if the first score is the same as the second", + "tests": [ + "1/02/03-sort" + ], + "hints": [ + "no case is necessary, use the `default` case" + ] + }, + { + "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", + "tests": [ + "1/02/04-sort" + ], + "actions": [ + "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" + ], + "hints": [ + "try using `myBest.sort()`" + ] + } + ], + "onPageComplete": "In the next step we'll look at changing data with `map`" + }, + { + "title": "Map", + "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", + "tasks": [ + { + "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", + "tests": [ + "1/03/01-map" + ], + "actions": [ + "open('03-map.js')", + "set('// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" + ], + "hints": [ + "give `changeGrade` a parameter, call it \"student\"", + "match for `student.grade`", + "match where `student.grade === 'A'`" + ] + }, + { + "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", + "tests": [ + "1/03/02-map" + ], + "actions": [ + "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" + ] + }, + { + "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myData` and instead increment each score by 12 points.", + "tests": [ + "1/03/03-map" + ], + "actions": [ + "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" + ], + "hints": [ + "give `increaseScore` a parameter, call it \"student\"", + "it should increase `student.score`", + "return `student`" + ] + }, + { + "description": "Wait. Now you're getting 105 in \"Algorithm Design\" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious.", + "tests": [ + "1/03/04-map" + ], + "hints": [ + "use an if clause within `increaseScore`", + "try `if (student.score >= 95) { student.score = 95 }`" + ] + }, + { + "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores.", + "tests": [ + "1/03/05-map" + ], + "actions": [ + "insert('\n// change `getGrade` to accept an object\n// and return an object\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nvar myFixed = mySlightlyChanged;\n')" + ], + "hints": [ + "change `getGrade` to take a `student` param instead of `score`", + "change the grade and return the `student`", + "set `student.grade = \"A\"` and return `student`" + ] + }, + { + "description": "Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only.", + "tests": [ + "1/03/06-map" + ], + "actions": [ + "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" + ], + "hints": [ + "use `map` to return only the \"score\" & \"grade\" fields", + "map with a function with a parameter, call it \"student\"", + "return `{ score: student.score, grade: student.grade }`" + ] + } + ], + "onPageComplete": "In the next step we'll compare `map` with `forEach`" + }, + { + "title": "forEach", + "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nvar x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nvar y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", + "tasks": [ + { + "description": "Use `forEach` to log out your report card to the console", + "tests": [ + "1/04/01-forEach" + ], + "actions": [ + "open('04-forEach.js')", + "set('// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" + ], + "hints": [ + "call `forEach` with `logCourse`" + ] + }, + { + "description": "Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`.", + "tests": [ + "1/04/02-forEach" + ], + "actions": [ + "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course::>) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" + ], + "hints": [ + "Array methods can take more than one parameter", + "Add a second parameter to `logCourseWithIndex`" + ] + }, + { + "description": "Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`.", + "tests": [ + "1/04/03-forEach" + ], + "actions": [ + "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index::>) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" + ], + "hints": [ + "Array methods can take more than one parameter", + "Add a third parameter to `logCourseWithIndexAndArray`" + ] + }, + { + "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.", + "tests": [ + "1/04/04-forEach" + ], + "actions": [ + "insert('\nconsole.log(myFixed);\n')" + ] + } + ], + "onPageComplete": "Something strange is going on. In the next step we'll try to `find` your data." + }, + { + "title": "find", + "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nvar data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", + "tasks": [ + { + "description": "`filter` to `students` in the class titled \"Web Security\"", + "tests": [ + "1/05/01-find" + ], + "actions": [ + "open('05-find.js')", + "set('// Array.find(fn)\n\n// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" + ], + "hints": [ + "create a `filter` function", + "filter for `student.title === \"Web Security\"`" + ] + }, + { + "description": "`find` the name in `myClass` that isn't in the list of known students", + "tests": [ + "1/05/02-find" + ], + "actions": [ + "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", + "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" + ], + "hints": [ + "use `indexOf` to find what doesn't match", + "use `otherStudents.indexOf(x) === -1` to find what doesn't match", + "match for `student.name`" + ] + }, + { + "description": "`filter` down to students without known names", + "tests": [ + "1/05/03-find" + ], + "actions": [ + "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" + ], + "hints": [ + "consider reusing a function" + ] + }, + { + "description": "`map` over the result to get only the `name` property", + "tests": [ + "1/05/04-find" + ], + "actions": [ + "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" + ], + "hints": [ + "use `map` to return only the `student.name`" + ] + }, + { + "description": "`join('')` the array of names to output the result as a string", + "tests": [ + "1/05/05-find" + ], + "actions": [ + "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" + ], + "hints": [ + "call `join` following `unknownStudentNames`" + ] + } + ], + "onPageComplete": "Very strange. In the next step, let's find out who wants revenge, and give it to him!" + }, + { + "title": "concat", + "description": "Array + Array -> Array\n\nBefore we've been working on a structured set of student data.\n\n```js\n// array of students\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n// students in courses...\n]\n```\n\nTo be safe, let's now work on the original data set. Notice how it is structured differently.\n\n```js\n// array of courses\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"students\": [\n {\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n // students...\n ]\n }\n // courses...\n]\n```\n\nIn this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses?\n\nWeird things happen when you start combining arrays. We can use `concat` to bring sanity.\n\n```js\n[1, 2] + [3, 4];\n//> \"1, 23, 4\"\n\n[1, 2].push([3, 4]);\n//> 3\n\n[1, 2].join([3, 4]);\n//> \"13, 42\"\n\n[1, 2].concat([3, 4]);\n//> [1, 2, 3, 4]\n```\n\nUnfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`).\n\n`flatten` should loop over an array and `concat` each element.\n\nLet's look at an abstraction of what we need to do:\n\n```js\nvar start = [{\n a: 1,\n c: [\n { b: 1 }\n ]\n}, {\n a: 2,\n c: [\n { b: 2 }, { b: 3 }\n ]\n}];\n\nvar middle = start.map(function(outer) {\n return outer.c.map(function(inner) {\n return {\n a: outer.a,\n b: inner.b\n };\n });\n});\n//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ]\n\nvar end = pre.flatten();\n//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}]\n```\n\nBack to business.\n\nWe have a suspect in mind: a classmate named \"Hack Kerr\". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name.\n\nWe'll test out flatten, then re-create our student array of data from the original course data.", + "tasks": [ + { + "description": "First, test out `flatten` on the `flattenedArray`", + "tests": [ + "1/06/01-concat" + ], + "actions": [ + "open('06-concat.js')", + "set('// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", + "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" + ], + "hints": [ + "call `.flatten()` on `numberedList`" + ] }, { - "title": "Filter", - "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", - "tasks": [ - { - "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", - "tests": [ - "1/01/01-filter" - ], - "actions": [ - "open('01-filter.js')", - "insert('// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" - ], - "hints": [ - "Some tasks have hints", - "Check if `student.name` matches \"Ada Lovelace\"", - "Use `===` to check equality" - ] - }, - { - "description": "Set `var myData` to filter with the `isAda` function.", - "tests": [ - "1/01/02-filter" - ], - "actions": [ - "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" - ], - "hints": [ - "Add a function to the `filter` call: `Array.filter(function() {})`", - "Pass `isAda` into your `filter` call" - ] - }, - { - "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", - "tests": [ - "1/01/03-filter" - ], - "actions": [ - "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" - ], - "hints": [ - "match for `student.grade` that isn't \"D\" or \"F\"", - "use `!==` to check non-equality", - "Match for both: `student.grade !== \"D\" && student.grade !== \"F\"`" - ] - }, - { - "description": "Set `var myBest` to your scores, excluding any grades that are \"D\" or \"F\".", - "tests": [ - "1/01/04-filter" - ], - "actions": [ - "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter(::>);\n\n')" - ] - } - ], - "onPageComplete": "In the next step we'll look at how to `sort` data" + "description": "Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score", + "tests": [ + "1/06/02-concat" + ], + "actions": [ + "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" + ], + "hints": [ + "pair `course.title`", + "pair `student.name`" + ] }, { - "title": "Sort", - "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", - "tasks": [ - { - "description": "`compareScore` should return 1 if the first score is less than the second", - "tests": [ - "1/02/01-sort" - ], - "actions": [ - "open('02-sort.js')", - "set('// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" - ] - }, - { - "description": "`compareScore` should return -1 if the first score is more than the second", - "tests": [ - "1/02/02-sort" - ], - "hints": [ - "set the second case to `b.score < a.score`" - ] - }, - { - "description": "`compareScore` should return 0 if the first score is the same as the second", - "tests": [ - "1/02/03-sort" - ], - "hints": [ - "no case is necessary, use the `default` case" - ] - }, - { - "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", - "tests": [ - "1/02/04-sort" - ], - "actions": [ - "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" - ], - "hints": [ - "try using `myBest.sort()`" - ] - } - ], - "onPageComplete": "In the next step we'll look at changing data with `map`" + "description": "Use `flatten` to put all data into a single array. Set `students` to the result.", + "tests": [ + "1/06/03-concat" + ], + "actions": [ + "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" + ], + "hints": [ + "call `.flatten()` on `doubleArray`" + ] }, { - "title": "Map", - "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", - "tasks": [ - { - "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", - "tests": [ - "1/03/01-map" - ], - "actions": [ - "open('03-map.js')", - "set('// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" - ], - "hints": [ - "give `changeGrade` a parameter, call it \"student\"", - "match for `student.grade`", - "match where `student.grade === 'A'`" - ] - }, - { - "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", - "tests": [ - "1/03/02-map" - ], - "actions": [ - "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" - ] - }, - { - "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myData` and instead increment each score by 12 points.", - "tests": [ - "1/03/03-map" - ], - "actions": [ - "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" - ], - "hints": [ - "give `increaseScore` a parameter, call it \"student\"", - "it should increase `student.score`", - "return `student`" - ] - }, - { - "description": "Wait. Now you're getting 105 in \"Algorithm Design\" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious.", - "tests": [ - "1/03/04-map" - ], - "hints": [ - "use an if clause within `increaseScore`", - "try `if (student.score >= 95) { student.score = 95 }`" - ] - }, - { - "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores.", - "tests": [ - "1/03/05-map" - ], - "actions": [ - "insert('\n// change `getGrade` to accept an object\n// and return an object\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nvar myFixed = mySlightlyChanged;\n')" - ], - "hints": [ - "change `getGrade` to take a `student` param instead of `score`", - "change the grade and return the `student`", - "set `student.grade = \"A\"` and return `student`" - ] - }, - { - "description": "Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only.", - "tests": [ - "1/03/06-map" - ], - "actions": [ - "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" - ], - "hints": [ - "use `map` to return only the \"score\" & \"grade\" fields", - "map with a function with a parameter, call it \"student\"", - "return `{ score: student.score, grade: student.grade }`" - ] - } - ], - "onPageComplete": "In the next step we'll compare `map` with `forEach`" + "description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data", + "tests": [ + "1/06/04-concat" + ], + "actions": [ + "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" + ] }, { - "title": "forEach", - "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nvar x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nvar y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", - "tasks": [ - { - "description": "Use `forEach` to log out your report card to the console", - "tests": [ - "1/04/01-forEach" - ], - "actions": [ - "open('04-forEach.js')", - "set('// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" - ], - "hints": [ - "call `forEach` with `logCourse`" - ] - }, - { - "description": "Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`.", - "tests": [ - "1/04/02-forEach" - ], - "actions": [ - "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course::>) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" - ], - "hints": [ - "Array methods can take more than one parameter", - "Add a second parameter to `logCourseWithIndex`" - ] - }, - { - "description": "Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`.", - "tests": [ - "1/04/03-forEach" - ], - "actions": [ - "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index::>) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" - ], - "hints": [ - "Array methods can take more than one parameter", - "Add a third parameter to `logCourseWithIndexAndArray`" - ] - }, - { - "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.", - "tests": [ - "1/04/04-forEach" - ], - "actions": [ - "insert('\nconsole.log(myFixed);\n')" - ] - } - ], - "onPageComplete": "Something strange is going on. In the next step we'll try to `find` your data." + "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nvar newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", + "tests": [ + "1/06/05-concat" + ], + "hints": [ + "call `suspects.concat()` with `newSuspects`" + ] + } + ], + "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" + }, + { + "title": "reduce", + "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nvar initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", + "tasks": [ + { + "description": "Use `reduce` to sum the numbers in the `practice` array", + "tests": [ + "1/07/01-reduce" + ], + "actions": [ + "open('07-reduce.js')", + "set('// Array.reduce(fn(a, b), initialValue)\n\nvar practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" + ], + "hints": [ + "with only numbers, the initialValue defaults to 0", + "just call `reduce` with `add`" + ] }, { - "title": "find", - "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nvar data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", - "tasks": [ - { - "description": "`filter` to `students` in the class titled \"Web Security\"", - "tests": [ - "1/05/01-find" - ], - "actions": [ - "open('05-find.js')", - "set('// Array.find(fn)\n\n// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" - ], - "hints": [ - "create a `filter` function", - "filter for `student.title === \"Web Security\"`" - ] - }, - { - "description": "`find` the name in `myClass` that isn't in the list of known students", - "tests": [ - "1/05/02-find" - ], - "actions": [ - "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", - "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" - ], - "hints": [ - "use `indexOf` to find what doesn't match", - "use `otherStudents.indexOf(x) === -1` to find what doesn't match", - "match for `student.name`" - ] - }, - { - "description": "`filter` down to students without known names", - "tests": [ - "1/05/03-find" - ], - "actions": [ - "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" - ], - "hints": [ - "consider reusing a function" - ] - }, - { - "description": "`map` over the result to get only the `name` property", - "tests": [ - "1/05/04-find" - ], - "actions": [ - "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" - ], - "hints": [ - "use `map` to return only the `student.name`" - ] - }, - { - "description": "`join('')` the array of names to output the result as a string", - "tests": [ - "1/05/05-find" - ], - "actions": [ - "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" - ], - "hints": [ - "call `join` following `unknownStudentNames`" - ] - } - ], - "onPageComplete": "Very strange. In the next step, let's find out who wants revenge, and give it to him!" + "description": "Not all reduce functions are so easy. `reduce` is a little more difficult to master.\n\n`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages.", + "tests": [ + "1/07/02-reduce" + ], + "actions": [ + "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" + ], + "hints": [ + "set the initialValue to 0", + "like this: `reduce(function () {}, 0)`", + "return the sum of `student.score` and `total`" + ] }, { - "title": "concat", - "description": "Array + Array -> Array\n\nBefore we've been working on a structured set of student data.\n\n```js\n// array of students\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n// students in courses...\n]\n```\n\nTo be safe, let's now work on the original data set. Notice how it is structured differently.\n\n```js\n// array of courses\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"students\": [\n {\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n // students...\n ]\n }\n // courses...\n]\n```\n\nIn this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses?\n\nWeird things happen when you start combining arrays. We can use `concat` to bring sanity.\n\n```js\n[1, 2] + [3, 4];\n//> \"1, 23, 4\"\n\n[1, 2].push([3, 4]);\n//> 3\n\n[1, 2].join([3, 4]);\n//> \"13, 42\"\n\n[1, 2].concat([3, 4]);\n//> [1, 2, 3, 4]\n```\n\nUnfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`).\n\n`flatten` should loop over an array and `concat` each element.\n\nLet's look at an abstraction of what we need to do:\n\n```js\nvar start = [{\n a: 1,\n c: [\n { b: 1 }\n ]\n}, {\n a: 2,\n c: [\n { b: 2 }, { b: 3 }\n ]\n}];\n\nvar middle = start.map(function(outer) {\n return outer.c.map(function(inner) {\n return {\n a: outer.a,\n b: inner.b\n };\n });\n});\n//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ]\n\nvar end = pre.flatten();\n//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}]\n```\n\nBack to business.\n\nWe have a suspect in mind: a classmate named \"Hack Kerr\". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name.\n\nWe'll test out flatten, then re-create our student array of data from the original course data.", - "tasks": [ - { - "description": "First, test out `flatten` on the `flattenedArray`", - "tests": [ - "1/06/01-concat" - ], - "actions": [ - "open('06-concat.js')", - "set('// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", - "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" - ], - "hints": [ - "call `.flatten()` on `numberedList`" - ] - }, - { - "description": "Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score", - "tests": [ - "1/06/02-concat" - ], - "actions": [ - "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" - ], - "hints": [ - "pair `course.title`", - "pair `student.name`" - ] - }, - { - "description": "Use `flatten` to put all data into a single array. Set `students` to the result.", - "tests": [ - "1/06/03-concat" - ], - "actions": [ - "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" - ], - "hints": [ - "call `.flatten()` on `doubleArray`" - ] - }, - { - "description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data", - "tests": [ - "1/06/04-concat" - ], - "actions": [ - "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" - ] - }, - { - "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nvar newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", - "tests": [ - "1/06/05-concat" - ], - "hints": [ - "call `suspects.concat()` with `newSuspects`" - ] - } - ], - "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" + "description": "`reduce` to an array of suspect scores from the `suspectData` we collected previously.", + "tests": [ + "1/07/03-reduce" + ], + "actions": [ + "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" + ], + "hints": [ + "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", + "match for `next.name` & `next.score`", + "you can concat the scores onto an array: `[].concat(next.score)`", + "if the name is already in the list, just add the `next.score`" + ] }, { - "title": "reduce", - "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nvar initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", - "tasks": [ - { - "description": "Use `reduce` to sum the numbers in the `practice` array", - "tests": [ - "1/07/01-reduce" - ], - "actions": [ - "open('07-reduce.js')", - "set('// Array.reduce(fn(a, b), initialValue)\n\nvar practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" - ], - "hints": [ - "with only numbers, the initialValue defaults to 0", - "just call `reduce` with `add`" - ] - }, - { - "description": "Not all reduce functions are so easy. `reduce` is a little more difficult to master.\n\n`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages.", - "tests": [ - "1/07/02-reduce" - ], - "actions": [ - "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" - ], - "hints": [ - "set the initialValue to 0", - "like this: `reduce(function () {}, 0)`", - "return the sum of `student.score` and `total`" - ] - }, - { - "description": "`reduce` to an array of suspect scores from the `suspectData` we collected previously.", - "tests": [ - "1/07/03-reduce" - ], - "actions": [ - "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" - ], - "hints": [ - "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", - "match for `next.name` & `next.score`", - "you can concat the scores onto an array: `[].concat(next.score)`", - "if the name is already in the list, just add the `next.score`" - ] - }, - { - "description": "`map` over suspect data to find the `\"difference\"` from subtracting the students score from the average score. Add this to `suspectScores` using the key `difference`. The resulting array should look like this:\n```js\n[{\n name: 'suspectName',\n scores: [50, 65, 75 ...],\n difference: 15\n}]\n```", - "tests": [ - "1/07/04-reduce" - ], - "actions": [ - "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" - ], - "hints": [ - "You may want to use a second param: `index`", - "Compare the `suspect.scores[index]` with the `averages[index]`", - "To get a sum, start your `reduce` function at 0" - ] - }, - { - "description": "`reduce` down to likely suspect names by filtering with the `isCheater` function.\n\nThis could be done with a `filter` & `map`, but it is simpler to just use one `reduce`.", - "tests": [ - "1/07/05-reduce" - ], - "actions": [ - "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" - ], - "hints": [ - "use `.join(', ')`" - ] - }, - { - "description": "It looks like we have a likely suspect.", - "tests": [ - "1/07/06-reduce" - ], - "actions": [ - "insert('console.log(likelySuspects);\n')" - ] - } + "description": "`map` over suspect data to find the `\"difference\"` from subtracting the students score from the average score. Add this to `suspectScores` using the key `difference`. The resulting array should look like this:\n```js\n[{\n name: 'suspectName',\n scores: [50, 65, 75 ...],\n difference: 15\n}]\n```", + "tests": [ + "1/07/04-reduce" + ], + "actions": [ + "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" + ], + "hints": [ + "You may want to use a second param: `index`", + "Compare the `suspect.scores[index]` with the `averages[index]`", + "To get a sum, start your `reduce` function at 0" ] }, { - "title": "Challenge 1", - "description": "coming soon\n\nYou'd better fix your name and scores back to the way they were." + "description": "`reduce` down to likely suspect names by filtering with the `isCheater` function.\n\nThis could be done with a `filter` & `map`, but it is simpler to just use one `reduce`.", + "tests": [ + "1/07/05-reduce" + ], + "actions": [ + "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" + ], + "hints": [ + "use `.join(', ')`" + ] }, { - "title": "Challenge 2", - "description": "coming soon\n\nIt's time to get revenge." + "description": "It looks like we have a likely suspect.", + "tests": [ + "1/07/06-reduce" + ], + "actions": [ + "insert('console.log(likelySuspects);\n')" + ] } ] + }, + { + "title": "Challenge 1", + "description": "coming soon\n\nYou'd better fix your name and scores back to the way they were." + }, + { + "title": "Challenge 2", + "description": "coming soon\n\nIt's time to get revenge." } ] } \ No newline at end of file diff --git a/tutorial/1/00/01-setup.spec.js b/tutorial/1/00/01-setup.spec.js index 5cbc47e..d8bedc1 100644 --- a/tutorial/1/00/01-setup.spec.js +++ b/tutorial/1/00/01-setup.spec.js @@ -8,29 +8,29 @@ var spy = chai.spy.on(console, 'log'); // load('data/students.js', true) // load('00-setup.js') -describe('01 first', function () { +describe('01 first', function() { - it('should exist', function () { - expect(first).to.be.defined; - }); + it('should exist', function() { + expect(first).to.be.defined; + }); - it('should be an object', function () { - expect(first).to.be.an('object'); - }); + it('should be an object', function() { + expect(first).to.be.an('object'); + }); - it('should take have property title', function () { - expect(first).to.have.property('title'); - }); + it('should take have property title', function() { + expect(first).to.have.property('title'); + }); - it('should have the correct value', function () { - var result = { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" - }; - expect(first).to.deep.equal(result); - }); + it('should have the correct value', function() { + var result = { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }; + expect(first).to.deep.equal(result); + }); }); diff --git a/tutorial/1/00/setup.md b/tutorial/1/00/setup.md index 6c57914..2f8e237 100644 --- a/tutorial/1/00/setup.md +++ b/tutorial/1/00/setup.md @@ -1,4 +1,4 @@ -### Start +## Start Understanding the Data Set Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. diff --git a/tutorial/1/01/filter.md b/tutorial/1/01/filter.md index d5d970a..f928ca2 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/1/01/filter.md @@ -1,4 +1,4 @@ -### Filter +## Filter Array -> Array of items that match a condition You've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card. diff --git a/tutorial/1/02/sort.md b/tutorial/1/02/sort.md index 3c4ede4..5b85096 100644 --- a/tutorial/1/02/sort.md +++ b/tutorial/1/02/sort.md @@ -1,4 +1,4 @@ -### Sort +## Sort Array -> sorted Array Your grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through. diff --git a/tutorial/1/03/map.md b/tutorial/1/03/map.md index 869461d..bfec26f 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/1/03/map.md @@ -1,4 +1,4 @@ -### Map +## Map Array -> run a function over each item -> Array You've filtered and sorted our data, but neither of those actually change the data. diff --git a/tutorial/1/04/forEach.md b/tutorial/1/04/forEach.md index 761accf..2a34f9a 100644 --- a/tutorial/1/04/forEach.md +++ b/tutorial/1/04/forEach.md @@ -1,4 +1,4 @@ -### forEach +## forEach Array -> run a function for each item You've updated your grades, but they're still in an array. It's time to loop over them and log them to the console. diff --git a/tutorial/1/05/find.md b/tutorial/1/05/find.md index 04a3603..9131b02 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/1/05/find.md @@ -1,4 +1,4 @@ -### find +## find Array -> first element that matches a condition Somehow your name has disappeared from the computer system. We'll have to `find` a way to get it back. diff --git a/tutorial/1/06/concat.md b/tutorial/1/06/concat.md index 31a61c3..5c7c5fe 100644 --- a/tutorial/1/06/concat.md +++ b/tutorial/1/06/concat.md @@ -1,4 +1,4 @@ -### concat +## concat Array + Array -> Array Before we've been working on a structured set of student data. diff --git a/tutorial/1/07/reduce.md b/tutorial/1/07/reduce.md index 5433dfb..c213f46 100644 --- a/tutorial/1/07/reduce.md +++ b/tutorial/1/07/reduce.md @@ -1,4 +1,4 @@ -### reduce +## reduce Array -> anything We know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades. diff --git a/tutorial/1/08/challenge-1.md b/tutorial/1/08/challenge-1.md index 682fad5..9b12ff6 100644 --- a/tutorial/1/08/challenge-1.md +++ b/tutorial/1/08/challenge-1.md @@ -1,4 +1,4 @@ -### Challenge 1 +## Challenge 1 coming soon You'd better fix your name and scores back to the way they were. diff --git a/tutorial/1/09/challenge-2.md b/tutorial/1/09/challenge-2.md index fd69fea..56e6e78 100644 --- a/tutorial/1/09/challenge-2.md +++ b/tutorial/1/09/challenge-2.md @@ -1,4 +1,4 @@ -### Challenge 2 +## Challenge 2 coming soon It's time to get revenge. diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index 921205c..7a79fb2 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -1,22 +1,20 @@ # Functional School -A trip through functional programming in Javascript. +A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`. + +By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. Level: Intermediate Keywords: javascript, functional Length: 1-2 hours -## Array Methods -Using common built-in Javascript array methods such as `map` & `reduce`. - -By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. -@import('./tutorial/1/00/setup') -@import('./tutorial/1/01/filter') -@import('./tutorial/1/02/sort') -@import('./tutorial/1/03/map') -@import('./tutorial/1/04/forEach') -@import('./tutorial/1/05/find') -@import('./tutorial/1/06/concat') -@import('./tutorial/1/07/reduce') -@import('./tutorial/1/08/challenge-1') -@import('./tutorial/1/09/challenge-2') +@import('1/00/setup') +@import('1/01/filter') +@import('1/02/sort') +@import('1/03/map') +@import('1/04/forEach') +@import('1/05/find') +@import('1/06/concat') +@import('1/07/reduce') +@import('1/08/challenge-1') +@import('1/09/challenge-2') From 2f59448a6f7b0dfd6b52396cbe779d9b1f017986 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 2 May 2016 10:30:17 -0700 Subject: [PATCH 18/46] increment version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2a4d026..84b64db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.4.0", + "version": "0.5.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -28,7 +28,7 @@ "chai": "3.5.0", "chai-spies": "0.7.1", "mocha": "2.4.5", - "mocha-coderoad": "^0.5.3" + "mocha-coderoad": "^0.6.0" }, "license": "MIT", "config": { From 2772e3861e0121d55d8db28ac806d4831e0155f8 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 3 May 2016 13:44:03 -0700 Subject: [PATCH 19/46] remove chapter folder --- coderoad.json | 70 ++++++++++++------------- tutorial/.tmp.spec.js | 72 ++++++++++++++++++++++++++ tutorial/{1 => }/00/01-setup.spec.js | 0 tutorial/{1 => }/00/02-setup.spec.js | 0 tutorial/{1 => }/00/03-setup.spec.js | 0 tutorial/{1 => }/00/setup.md | 8 +-- tutorial/{1 => }/01/01-filter.spec.js | 0 tutorial/{1 => }/01/02-filter.spec.js | 0 tutorial/{1 => }/01/03-filter.spec.js | 0 tutorial/{1 => }/01/04-filter.spec.js | 0 tutorial/{1 => }/01/filter.md | 6 +-- tutorial/02/01-sort.spec.js | 26 ++++++++++ tutorial/{1 => }/02/02-sort.spec.js | 0 tutorial/{1 => }/02/03-sort.spec.js | 0 tutorial/{1 => }/02/04-sort.spec.js | 0 tutorial/{1 => }/02/myBest.js | 0 tutorial/{1 => }/02/sort.md | 8 +-- tutorial/03/01-map.spec.js | 53 +++++++++++++++++++ tutorial/{1 => }/03/02-map.spec.js | 0 tutorial/{1 => }/03/03-map.spec.js | 0 tutorial/{1 => }/03/04-map.spec.js | 0 tutorial/{1 => }/03/05-map.spec.js | 0 tutorial/{1 => }/03/06-map.spec.js | 0 tutorial/{1 => }/03/map.md | 10 ++-- tutorial/{1 => }/03/myData.js | 0 tutorial/04/01-forEach.spec.js | 23 ++++++++ tutorial/{1 => }/04/02-forEach.spec.js | 0 tutorial/{1 => }/04/03-forEach.spec.js | 0 tutorial/{1 => }/04/04-forEach.spec.js | 0 tutorial/{1 => }/04/forEach.md | 8 +-- tutorial/{1 => }/04/myFixed.js | 0 tutorial/{1 => }/05/01-find.spec.js | 0 tutorial/{1 => }/05/02-find.spec.js | 0 tutorial/{1 => }/05/03-find.spec.js | 0 tutorial/{1 => }/05/04-find.spec.js | 0 tutorial/{1 => }/05/05-find.spec.js | 0 tutorial/{1 => }/05/find.md | 10 ++-- tutorial/{1 => }/06/01-concat.spec.js | 0 tutorial/{1 => }/06/02-concat.spec.js | 0 tutorial/{1 => }/06/03-concat.spec.js | 0 tutorial/{1 => }/06/04-concat.spec.js | 0 tutorial/{1 => }/06/05-concat.spec.js | 0 tutorial/{1 => }/06/concat.md | 10 ++-- tutorial/{1 => }/07/01-reduce.spec.js | 8 +-- tutorial/{1 => }/07/02-reduce.spec.js | 0 tutorial/{1 => }/07/03-reduce.spec.js | 0 tutorial/{1 => }/07/04-reduce.spec.js | 0 tutorial/{1 => }/07/05-reduce.spec.js | 0 tutorial/{1 => }/07/06-reduce.spec.js | 0 tutorial/{1 => }/07/reduce.md | 12 ++--- tutorial/{1 => }/07/suspectData.js | 0 tutorial/{1 => }/08/01.spec.js | 0 tutorial/{1 => }/08/challenge-1.md | 0 tutorial/{1 => }/09/challenge-2.md | 0 tutorial/1/02/01-sort.spec.js | 22 -------- tutorial/1/03/01-map.spec.js | 53 ------------------- tutorial/1/04/01-forEach.spec.js | 23 -------- tutorial/tutorial.md | 20 +++---- 58 files changed, 259 insertions(+), 183 deletions(-) create mode 100644 tutorial/.tmp.spec.js rename tutorial/{1 => }/00/01-setup.spec.js (100%) rename tutorial/{1 => }/00/02-setup.spec.js (100%) rename tutorial/{1 => }/00/03-setup.spec.js (100%) rename tutorial/{1 => }/00/setup.md (93%) rename tutorial/{1 => }/01/01-filter.spec.js (100%) rename tutorial/{1 => }/01/02-filter.spec.js (100%) rename tutorial/{1 => }/01/03-filter.spec.js (100%) rename tutorial/{1 => }/01/04-filter.spec.js (100%) rename tutorial/{1 => }/01/filter.md (97%) create mode 100644 tutorial/02/01-sort.spec.js rename tutorial/{1 => }/02/02-sort.spec.js (100%) rename tutorial/{1 => }/02/03-sort.spec.js (100%) rename tutorial/{1 => }/02/04-sort.spec.js (100%) rename tutorial/{1 => }/02/myBest.js (100%) rename tutorial/{1 => }/02/sort.md (95%) create mode 100644 tutorial/03/01-map.spec.js rename tutorial/{1 => }/03/02-map.spec.js (100%) rename tutorial/{1 => }/03/03-map.spec.js (100%) rename tutorial/{1 => }/03/04-map.spec.js (100%) rename tutorial/{1 => }/03/05-map.spec.js (100%) rename tutorial/{1 => }/03/06-map.spec.js (100%) rename tutorial/{1 => }/03/map.md (97%) rename tutorial/{1 => }/03/myData.js (100%) create mode 100644 tutorial/04/01-forEach.spec.js rename tutorial/{1 => }/04/02-forEach.spec.js (100%) rename tutorial/{1 => }/04/03-forEach.spec.js (100%) rename tutorial/{1 => }/04/04-forEach.spec.js (100%) rename tutorial/{1 => }/04/forEach.md (97%) rename tutorial/{1 => }/04/myFixed.js (100%) rename tutorial/{1 => }/05/01-find.spec.js (100%) rename tutorial/{1 => }/05/02-find.spec.js (100%) rename tutorial/{1 => }/05/03-find.spec.js (100%) rename tutorial/{1 => }/05/04-find.spec.js (100%) rename tutorial/{1 => }/05/05-find.spec.js (100%) rename tutorial/{1 => }/05/find.md (95%) rename tutorial/{1 => }/06/01-concat.spec.js (100%) rename tutorial/{1 => }/06/02-concat.spec.js (100%) rename tutorial/{1 => }/06/03-concat.spec.js (100%) rename tutorial/{1 => }/06/04-concat.spec.js (100%) rename tutorial/{1 => }/06/05-concat.spec.js (100%) rename tutorial/{1 => }/06/concat.md (96%) rename tutorial/{1 => }/07/01-reduce.spec.js (57%) rename tutorial/{1 => }/07/02-reduce.spec.js (100%) rename tutorial/{1 => }/07/03-reduce.spec.js (100%) rename tutorial/{1 => }/07/04-reduce.spec.js (100%) rename tutorial/{1 => }/07/05-reduce.spec.js (100%) rename tutorial/{1 => }/07/06-reduce.spec.js (100%) rename tutorial/{1 => }/07/reduce.md (97%) rename tutorial/{1 => }/07/suspectData.js (100%) rename tutorial/{1 => }/08/01.spec.js (100%) rename tutorial/{1 => }/08/challenge-1.md (100%) rename tutorial/{1 => }/09/challenge-2.md (100%) delete mode 100644 tutorial/1/02/01-sort.spec.js delete mode 100644 tutorial/1/03/01-map.spec.js delete mode 100644 tutorial/1/04/01-forEach.spec.js diff --git a/coderoad.json b/coderoad.json index 1fad1d1..8c5de7f 100644 --- a/coderoad.json +++ b/coderoad.json @@ -11,7 +11,7 @@ { "description": "Set `first` to the first item in the `students` array.", "tests": [ - "1/00/01-setup" + "00/01-setup" ], "actions": [ "open('00-setup.js')", @@ -25,7 +25,7 @@ { "description": "Set `myName` to the \"name\" of the first student in the list.", "tests": [ - "1/00/02-setup" + "00/02-setup" ], "actions": [ "insert('var myName= ::>\n')" @@ -39,7 +39,7 @@ { "description": "Log your name to the console.", "tests": [ - "1/00/03-setup" + "00/03-setup" ], "actions": [ "insert('\nconsole.log(::>);\n')" @@ -59,7 +59,7 @@ { "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", "tests": [ - "1/01/01-filter" + "01/01-filter" ], "actions": [ "open('01-filter.js')", @@ -74,7 +74,7 @@ { "description": "Set `var myData` to filter with the `isAda` function.", "tests": [ - "1/01/02-filter" + "01/02-filter" ], "actions": [ "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" @@ -87,7 +87,7 @@ { "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", "tests": [ - "1/01/03-filter" + "01/03-filter" ], "actions": [ "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" @@ -117,7 +117,7 @@ { "description": "`compareScore` should return 1 if the first score is less than the second", "tests": [ - "1/02/01-sort" + "02/01-sort" ], "actions": [ "open('02-sort.js')", @@ -127,7 +127,7 @@ { "description": "`compareScore` should return -1 if the first score is more than the second", "tests": [ - "1/02/02-sort" + "02/02-sort" ], "hints": [ "set the second case to `b.score < a.score`" @@ -136,7 +136,7 @@ { "description": "`compareScore` should return 0 if the first score is the same as the second", "tests": [ - "1/02/03-sort" + "02/03-sort" ], "hints": [ "no case is necessary, use the `default` case" @@ -145,7 +145,7 @@ { "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", "tests": [ - "1/02/04-sort" + "02/04-sort" ], "actions": [ "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" @@ -164,7 +164,7 @@ { "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", "tests": [ - "1/03/01-map" + "03/01-map" ], "actions": [ "open('03-map.js')", @@ -179,7 +179,7 @@ { "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", "tests": [ - "1/03/02-map" + "03/02-map" ], "actions": [ "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" @@ -188,7 +188,7 @@ { "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myData` and instead increment each score by 12 points.", "tests": [ - "1/03/03-map" + "03/03-map" ], "actions": [ "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" @@ -212,7 +212,7 @@ { "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores.", "tests": [ - "1/03/05-map" + "03/05-map" ], "actions": [ "insert('\n// change `getGrade` to accept an object\n// and return an object\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nvar myFixed = mySlightlyChanged;\n')" @@ -226,7 +226,7 @@ { "description": "Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only.", "tests": [ - "1/03/06-map" + "03/06-map" ], "actions": [ "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" @@ -247,7 +247,7 @@ { "description": "Use `forEach` to log out your report card to the console", "tests": [ - "1/04/01-forEach" + "04/01-forEach" ], "actions": [ "open('04-forEach.js')", @@ -260,7 +260,7 @@ { "description": "Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`.", "tests": [ - "1/04/02-forEach" + "04/02-forEach" ], "actions": [ "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course::>) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" @@ -273,7 +273,7 @@ { "description": "Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`.", "tests": [ - "1/04/03-forEach" + "04/03-forEach" ], "actions": [ "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index::>) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" @@ -286,7 +286,7 @@ { "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.", "tests": [ - "1/04/04-forEach" + "04/04-forEach" ], "actions": [ "insert('\nconsole.log(myFixed);\n')" @@ -302,7 +302,7 @@ { "description": "`filter` to `students` in the class titled \"Web Security\"", "tests": [ - "1/05/01-find" + "05/01-find" ], "actions": [ "open('05-find.js')", @@ -316,7 +316,7 @@ { "description": "`find` the name in `myClass` that isn't in the list of known students", "tests": [ - "1/05/02-find" + "05/02-find" ], "actions": [ "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", @@ -331,7 +331,7 @@ { "description": "`filter` down to students without known names", "tests": [ - "1/05/03-find" + "05/03-find" ], "actions": [ "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" @@ -343,7 +343,7 @@ { "description": "`map` over the result to get only the `name` property", "tests": [ - "1/05/04-find" + "05/04-find" ], "actions": [ "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" @@ -355,7 +355,7 @@ { "description": "`join('')` the array of names to output the result as a string", "tests": [ - "1/05/05-find" + "05/05-find" ], "actions": [ "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" @@ -374,7 +374,7 @@ { "description": "First, test out `flatten` on the `flattenedArray`", "tests": [ - "1/06/01-concat" + "06/01-concat" ], "actions": [ "open('06-concat.js')", @@ -388,7 +388,7 @@ { "description": "Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score", "tests": [ - "1/06/02-concat" + "06/02-concat" ], "actions": [ "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" @@ -401,7 +401,7 @@ { "description": "Use `flatten` to put all data into a single array. Set `students` to the result.", "tests": [ - "1/06/03-concat" + "06/03-concat" ], "actions": [ "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" @@ -413,7 +413,7 @@ { "description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data", "tests": [ - "1/06/04-concat" + "06/04-concat" ], "actions": [ "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" @@ -422,7 +422,7 @@ { "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nvar newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", "tests": [ - "1/06/05-concat" + "06/05-concat" ], "hints": [ "call `suspects.concat()` with `newSuspects`" @@ -438,7 +438,7 @@ { "description": "Use `reduce` to sum the numbers in the `practice` array", "tests": [ - "1/07/01-reduce" + "07/01-reduce" ], "actions": [ "open('07-reduce.js')", @@ -452,7 +452,7 @@ { "description": "Not all reduce functions are so easy. `reduce` is a little more difficult to master.\n\n`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages.", "tests": [ - "1/07/02-reduce" + "07/02-reduce" ], "actions": [ "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" @@ -466,7 +466,7 @@ { "description": "`reduce` to an array of suspect scores from the `suspectData` we collected previously.", "tests": [ - "1/07/03-reduce" + "07/03-reduce" ], "actions": [ "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" @@ -481,7 +481,7 @@ { "description": "`map` over suspect data to find the `\"difference\"` from subtracting the students score from the average score. Add this to `suspectScores` using the key `difference`. The resulting array should look like this:\n```js\n[{\n name: 'suspectName',\n scores: [50, 65, 75 ...],\n difference: 15\n}]\n```", "tests": [ - "1/07/04-reduce" + "07/04-reduce" ], "actions": [ "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" @@ -495,7 +495,7 @@ { "description": "`reduce` down to likely suspect names by filtering with the `isCheater` function.\n\nThis could be done with a `filter` & `map`, but it is simpler to just use one `reduce`.", "tests": [ - "1/07/05-reduce" + "07/05-reduce" ], "actions": [ "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" @@ -507,7 +507,7 @@ { "description": "It looks like we have a likely suspect.", "tests": [ - "1/07/06-reduce" + "07/06-reduce" ], "actions": [ "insert('console.log(likelySuspects);\n')" diff --git a/tutorial/.tmp.spec.js b/tutorial/.tmp.spec.js new file mode 100644 index 0000000..b285593 --- /dev/null +++ b/tutorial/.tmp.spec.js @@ -0,0 +1,72 @@ +"use strict"; +var chai = require('chai'); +var spies = require('chai-spies'); +var expect = chai.expect; +chai.use(spies); +var spy = chai.spy.on(console, 'log'); + +var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; + +// Welcome to CodeRoad! + +var first = students[0]; +var myName = first.name; +console.log(myName); + + +describe('01 first', function() { + + it('should exist', function() { + expect(first).to.be.defined; + }); + + it('should be an object', function() { + expect(first).to.be.an('object'); + }); + + it('should take have property title', function() { + expect(first).to.have.property('title'); + }); + + it('should have the correct value', function() { + var result = { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }; + expect(first).to.deep.equal(result); + }); + +}); + +describe('02 myName', function () { + + it('should exist', function () { + expect(myName).to.be.defined; + }); + + it('should be a string', function () { + expect(myName).to.be.a('string'); + }); + + it('should have the correct value', function () { + var result = 'Ada Lovelace'; + expect(myName).to.deep.equal(result); + }); + +}); + +describe('03 console.log', function() { + + it('should use `console.log` to log the name', function() { + expect(spy).to.have.been.called(); + }) + + it('should log `myName` to the console', function() { + expect(spy).to.have.been.called.with('Ada Lovelace'); + }); + +}); + diff --git a/tutorial/1/00/01-setup.spec.js b/tutorial/00/01-setup.spec.js similarity index 100% rename from tutorial/1/00/01-setup.spec.js rename to tutorial/00/01-setup.spec.js diff --git a/tutorial/1/00/02-setup.spec.js b/tutorial/00/02-setup.spec.js similarity index 100% rename from tutorial/1/00/02-setup.spec.js rename to tutorial/00/02-setup.spec.js diff --git a/tutorial/1/00/03-setup.spec.js b/tutorial/00/03-setup.spec.js similarity index 100% rename from tutorial/1/00/03-setup.spec.js rename to tutorial/00/03-setup.spec.js diff --git a/tutorial/1/00/setup.md b/tutorial/00/setup.md similarity index 93% rename from tutorial/1/00/setup.md rename to tutorial/00/setup.md index 2f8e237..e83dca4 100644 --- a/tutorial/1/00/setup.md +++ b/tutorial/00/setup.md @@ -26,7 +26,7 @@ console.log( ``` + Set `first` to the first item in the `students` array. -@test('1/00/01-setup') +@test('00/01-setup') @action(open('00-setup.js')) @action(set( ``` @@ -40,10 +40,10 @@ var first = ::> + Set `myName` to the "name" of the first student in the list. -@test('1/00/02-setup') +@test('00/02-setup') @action(insert( ``` -var myName= ::> +var myName = ::> ``` )) @hint('Get the first "name" in the students using the array index') @@ -51,7 +51,7 @@ var myName= ::> @hint('Try `first.name`') + Log your name to the console. -@test('1/00/03-setup') +@test('00/03-setup') @action(insert( ``` diff --git a/tutorial/1/01/01-filter.spec.js b/tutorial/01/01-filter.spec.js similarity index 100% rename from tutorial/1/01/01-filter.spec.js rename to tutorial/01/01-filter.spec.js diff --git a/tutorial/1/01/02-filter.spec.js b/tutorial/01/02-filter.spec.js similarity index 100% rename from tutorial/1/01/02-filter.spec.js rename to tutorial/01/02-filter.spec.js diff --git a/tutorial/1/01/03-filter.spec.js b/tutorial/01/03-filter.spec.js similarity index 100% rename from tutorial/1/01/03-filter.spec.js rename to tutorial/01/03-filter.spec.js diff --git a/tutorial/1/01/04-filter.spec.js b/tutorial/01/04-filter.spec.js similarity index 100% rename from tutorial/1/01/04-filter.spec.js rename to tutorial/01/04-filter.spec.js diff --git a/tutorial/1/01/filter.md b/tutorial/01/filter.md similarity index 97% rename from tutorial/1/01/filter.md rename to tutorial/01/filter.md index f928ca2..a66b1d5 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/01/filter.md @@ -52,7 +52,7 @@ console.log(students[0]); ``` + Write a filter condition function called `isAda` that returns true only if the name matches your name: "Ada Lovelace". -@test('1/01/01-filter') +@test('01/01-filter') @action(open('01-filter.js')) @action(insert( ``` @@ -70,7 +70,7 @@ function isAda(student) { @hint('Use `===` to check equality') + Set `var myData` to filter with the `isAda` function. -@test('1/01/02-filter') +@test('01/02-filter') @action(insert( ``` // run the function name in filter @@ -81,7 +81,7 @@ var myData = students.filter(::>); @hint('Pass `isAda` into your `filter` call') + Write a filter condition called `isGoodGrade` that will filter out any "D" or "F" grades. -@test('1/01/03-filter') +@test('01/03-filter') @action(insert( ``` diff --git a/tutorial/02/01-sort.spec.js b/tutorial/02/01-sort.spec.js new file mode 100644 index 0000000..a961af4 --- /dev/null +++ b/tutorial/02/01-sort.spec.js @@ -0,0 +1,26 @@ +var expect = require('chai').expect; + +// load('02/myBest.js', true) +// load('02-sort.js') + +describe('01 function compareScore', function() { + it('doesn\'t exist', function() { + expect(compareScore).to.not.be.undefined; + }); + + it('isn\'t a Function', function() { + expect(compareScore).to.be.a('function'); + }); + + it('doesn\'t have two params', function() { + expect(compareScore.length).to.equal(2); + }); + + it('doesn\'t return 1 when b\'s score is more than a\'s', function() { + expect(compareScore({ + score: 3 + }, { + score: 5 + })).to.equal(1); + }); +}); diff --git a/tutorial/1/02/02-sort.spec.js b/tutorial/02/02-sort.spec.js similarity index 100% rename from tutorial/1/02/02-sort.spec.js rename to tutorial/02/02-sort.spec.js diff --git a/tutorial/1/02/03-sort.spec.js b/tutorial/02/03-sort.spec.js similarity index 100% rename from tutorial/1/02/03-sort.spec.js rename to tutorial/02/03-sort.spec.js diff --git a/tutorial/1/02/04-sort.spec.js b/tutorial/02/04-sort.spec.js similarity index 100% rename from tutorial/1/02/04-sort.spec.js rename to tutorial/02/04-sort.spec.js diff --git a/tutorial/1/02/myBest.js b/tutorial/02/myBest.js similarity index 100% rename from tutorial/1/02/myBest.js rename to tutorial/02/myBest.js diff --git a/tutorial/1/02/sort.md b/tutorial/02/sort.md similarity index 95% rename from tutorial/1/02/sort.md rename to tutorial/02/sort.md index 5b85096..b9a0153 100644 --- a/tutorial/1/02/sort.md +++ b/tutorial/02/sort.md @@ -33,7 +33,7 @@ Alright, now time to sort your best grades to the top. First you'll need to write a sort condition function called `compareScore`. + `compareScore` should return 1 if the first score is less than the second -@test('1/02/01-sort') +@test('02/01-sort') @action(open('02-sort.js')) @action(set( ``` @@ -55,15 +55,15 @@ function compareScore(a, b) { ``` )) + `compareScore` should return -1 if the first score is more than the second -@test('1/02/02-sort') +@test('02/02-sort') @hint('set the second case to `b.score < a.score`') + `compareScore` should return 0 if the first score is the same as the second -@test('1/02/03-sort') +@test('02/03-sort') @hint('no case is necessary, use the `default` case') + Set `mySorted` to the result of `myBest` sorted by `compareScore` -@test('1/02/04-sort') +@test('02/04-sort') @action(insert( ``` // use the compare function to sort myBest diff --git a/tutorial/03/01-map.spec.js b/tutorial/03/01-map.spec.js new file mode 100644 index 0000000..fddae04 --- /dev/null +++ b/tutorial/03/01-map.spec.js @@ -0,0 +1,53 @@ +var expect = require('chai').expect; + +// load('03/myData.js', true) +// load('03-map.js') + +describe('01 function changeGrade', function() { + + it('doesn\'t exist', function() { + expect(changeGrade).to.not.be.undefined; + }); + + it('isn\'t a function', function() { + expect(changeGrade).to.be.a('function'); + }); + + it('should take a parameter', function() { + expect(changeGrade).to.have.length(1); + }); + + it('should try changing `student.grade` first before returning `student`', function() { + var regex = /return [a-zA-Z]+\.grade/; + var func = changeGrade.toString(); + expect(func.match(regex)).to.be.null; + }); + + it('should change grades from a D to an A', function() { + var test = { + grade: 'D' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + + it('should change grades from a F to an A', function() { + var test = { + grade: 'F' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + + it('should change grades from a B to an A', function() { + var test = { + grade: 'B' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + +}); diff --git a/tutorial/1/03/02-map.spec.js b/tutorial/03/02-map.spec.js similarity index 100% rename from tutorial/1/03/02-map.spec.js rename to tutorial/03/02-map.spec.js diff --git a/tutorial/1/03/03-map.spec.js b/tutorial/03/03-map.spec.js similarity index 100% rename from tutorial/1/03/03-map.spec.js rename to tutorial/03/03-map.spec.js diff --git a/tutorial/1/03/04-map.spec.js b/tutorial/03/04-map.spec.js similarity index 100% rename from tutorial/1/03/04-map.spec.js rename to tutorial/03/04-map.spec.js diff --git a/tutorial/1/03/05-map.spec.js b/tutorial/03/05-map.spec.js similarity index 100% rename from tutorial/1/03/05-map.spec.js rename to tutorial/03/05-map.spec.js diff --git a/tutorial/1/03/06-map.spec.js b/tutorial/03/06-map.spec.js similarity index 100% rename from tutorial/1/03/06-map.spec.js rename to tutorial/03/06-map.spec.js diff --git a/tutorial/1/03/map.md b/tutorial/03/map.md similarity index 97% rename from tutorial/1/03/map.md rename to tutorial/03/map.md index bfec26f..cd0fa84 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/03/map.md @@ -57,7 +57,7 @@ Those D & F grades would look a lot better if they suddenly became A's. Let's go back to before we filtered out the bad grades, and instead change the grades to A's. + Make a function `changeGrade` that takes student data and changes all grades to "A"s. -@test('1/03/01-map') +@test('03/01-map') @action(open('03-map.js')) @action(set( ``` @@ -75,7 +75,7 @@ function changeGrade(::>) { + Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result. -@test('1/03/02-map') +@test('03/02-map') @action(insert( ``` // map over `myData` with the `changeGrade` function @@ -87,7 +87,7 @@ var myChanged = myData.map(::>); + Hold up. An A in "Data Science" class looks way to suspicious. Your parents might catch on to your cheating. Let's go back to `myData` and instead increment each score by 12 points. -@test('1/03/03-map') +@test('03/03-map') @action(insert( ``` @@ -109,7 +109,7 @@ var mySlightlyChanged = myData; @hint('try `if (student.score >= 95) { student.score = 95 }`') + One more problem. Now the scores don't match the grades. you have 95 score in "3D Computer Graphics", but only a "B" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores. -@test('1/03/05-map') +@test('03/05-map') @action(insert( ``` @@ -139,7 +139,7 @@ var myFixed = mySlightlyChanged; @hint('set `student.grade = "A"` and return `student`') + Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only. -@test('1/03/06-map') +@test('03/06-map') @action(insert( ``` diff --git a/tutorial/1/03/myData.js b/tutorial/03/myData.js similarity index 100% rename from tutorial/1/03/myData.js rename to tutorial/03/myData.js diff --git a/tutorial/04/01-forEach.spec.js b/tutorial/04/01-forEach.spec.js new file mode 100644 index 0000000..7329330 --- /dev/null +++ b/tutorial/04/01-forEach.spec.js @@ -0,0 +1,23 @@ +'use strict'; +var chai = require('chai'); +var spies = require('chai-spies'); +var expect = chai.expect; +chai.use(spies); + +// load('04/myFixed.js', true) +if (process.env.TASK_POSITION === '4') { + myFixed = []; +} +var spy = chai.spy.on(console, 'log'); +// load('04-forEach.js') + +describe('01 console.log', function() { + + if (process.env.TASK_POSITION !== '4') { + it('should be called 10 times', function() { + expect(spy).to.have.been.called.with('A 95 Relational Databases'); + expect(spy).to.have.been.called.with('C 77 Networks'); + }); + } + +}); diff --git a/tutorial/1/04/02-forEach.spec.js b/tutorial/04/02-forEach.spec.js similarity index 100% rename from tutorial/1/04/02-forEach.spec.js rename to tutorial/04/02-forEach.spec.js diff --git a/tutorial/1/04/03-forEach.spec.js b/tutorial/04/03-forEach.spec.js similarity index 100% rename from tutorial/1/04/03-forEach.spec.js rename to tutorial/04/03-forEach.spec.js diff --git a/tutorial/1/04/04-forEach.spec.js b/tutorial/04/04-forEach.spec.js similarity index 100% rename from tutorial/1/04/04-forEach.spec.js rename to tutorial/04/04-forEach.spec.js diff --git a/tutorial/1/04/forEach.md b/tutorial/04/forEach.md similarity index 97% rename from tutorial/1/04/forEach.md rename to tutorial/04/forEach.md index 2a34f9a..49d5128 100644 --- a/tutorial/1/04/forEach.md +++ b/tutorial/04/forEach.md @@ -87,7 +87,7 @@ function addOneToLog(x) { Now that we see how `forEach` works, let's use it to make calls to the `console`. + Use `forEach` to log out your report card to the console -@test('1/04/01-forEach') +@test('04/01-forEach') @action(open('04-forEach.js')) @action(set( ``` @@ -104,7 +104,7 @@ myFixed.forEach(::>); @hint('call `forEach` with `logCourse`') + Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`. -@test('1/04/02-forEach') +@test('04/02-forEach') @action(insert( ``` @@ -121,7 +121,7 @@ myFixed.forEach(logCourseWithIndex); @hint('Add a second parameter to `logCourseWithIndex`') + Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`. -@test('1/04/03-forEach') +@test('04/03-forEach') @action(insert( ``` @@ -152,7 +152,7 @@ myFixed = students This is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected. -@test('1/04/04-forEach') +@test('04/04-forEach') @action(insert( ``` diff --git a/tutorial/1/04/myFixed.js b/tutorial/04/myFixed.js similarity index 100% rename from tutorial/1/04/myFixed.js rename to tutorial/04/myFixed.js diff --git a/tutorial/1/05/01-find.spec.js b/tutorial/05/01-find.spec.js similarity index 100% rename from tutorial/1/05/01-find.spec.js rename to tutorial/05/01-find.spec.js diff --git a/tutorial/1/05/02-find.spec.js b/tutorial/05/02-find.spec.js similarity index 100% rename from tutorial/1/05/02-find.spec.js rename to tutorial/05/02-find.spec.js diff --git a/tutorial/1/05/03-find.spec.js b/tutorial/05/03-find.spec.js similarity index 100% rename from tutorial/1/05/03-find.spec.js rename to tutorial/05/03-find.spec.js diff --git a/tutorial/1/05/04-find.spec.js b/tutorial/05/04-find.spec.js similarity index 100% rename from tutorial/1/05/04-find.spec.js rename to tutorial/05/04-find.spec.js diff --git a/tutorial/1/05/05-find.spec.js b/tutorial/05/05-find.spec.js similarity index 100% rename from tutorial/1/05/05-find.spec.js rename to tutorial/05/05-find.spec.js diff --git a/tutorial/1/05/find.md b/tutorial/05/find.md similarity index 95% rename from tutorial/1/05/find.md rename to tutorial/05/find.md index 9131b02..459fb47 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/05/find.md @@ -26,7 +26,7 @@ data.find(isEven); Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. + `filter` to `students` in the class titled "Web Security" -@test('1/05/01-find') +@test('05/01-find') @action(open('05-find.js')) @action(set( ``` @@ -40,7 +40,7 @@ var myClass = students.filter(::>); @hint('filter for `student.title === "Web Security"`') + `find` the name in `myClass` that isn't in the list of known students -@test('1/05/02-find') +@test('05/02-find') @action(insert( ``` @@ -65,7 +65,7 @@ var unknownStudent = myClass.find(); @hint('match for `student.name`') + `filter` down to students without known names -@test('1/05/03-find') +@test('05/03-find') @action(insert( ``` @@ -76,7 +76,7 @@ var unknownStudentList = students.filter(::>); @hint('consider reusing a function') + `map` over the result to get only the `name` property -@test('1/05/04-find') +@test('05/04-find') @action(insert( ``` @@ -87,7 +87,7 @@ var unknownStudentNames = unknownStudentList.map(::>); @hint('use `map` to return only the `student.name`') + `join('')` the array of names to output the result as a string -@test('1/05/05-find') +@test('05/05-find') @action(insert( ``` diff --git a/tutorial/1/06/01-concat.spec.js b/tutorial/06/01-concat.spec.js similarity index 100% rename from tutorial/1/06/01-concat.spec.js rename to tutorial/06/01-concat.spec.js diff --git a/tutorial/1/06/02-concat.spec.js b/tutorial/06/02-concat.spec.js similarity index 100% rename from tutorial/1/06/02-concat.spec.js rename to tutorial/06/02-concat.spec.js diff --git a/tutorial/1/06/03-concat.spec.js b/tutorial/06/03-concat.spec.js similarity index 100% rename from tutorial/1/06/03-concat.spec.js rename to tutorial/06/03-concat.spec.js diff --git a/tutorial/1/06/04-concat.spec.js b/tutorial/06/04-concat.spec.js similarity index 100% rename from tutorial/1/06/04-concat.spec.js rename to tutorial/06/04-concat.spec.js diff --git a/tutorial/1/06/05-concat.spec.js b/tutorial/06/05-concat.spec.js similarity index 100% rename from tutorial/1/06/05-concat.spec.js rename to tutorial/06/05-concat.spec.js diff --git a/tutorial/1/06/concat.md b/tutorial/06/concat.md similarity index 96% rename from tutorial/1/06/concat.md rename to tutorial/06/concat.md index 5c7c5fe..f5e1b9a 100644 --- a/tutorial/1/06/concat.md +++ b/tutorial/06/concat.md @@ -96,7 +96,7 @@ We have a suspect in mind: a classmate named "Hack Kerr". He's a nice guy, and h We'll test out flatten, then re-create our student array of data from the original course data. + First, test out `flatten` on the `flattenedArray` -@test('1/06/01-concat') +@test('06/01-concat') @action(open('06-concat.js')) @action(set( ``` @@ -130,7 +130,7 @@ Return the fields: * name * grade * score -@test('1/06/02-concat') +@test('06/02-concat') @action(insert( ``` @@ -155,7 +155,7 @@ var doubleArray = courses.map(function(course) { @hint('pair `student.name`') + Use `flatten` to put all data into a single array. Set `students` to the result. -@test('1/06/03-concat') +@test('06/03-concat') @action(insert( ``` // `flatten` doubleArray @@ -165,7 +165,7 @@ var students = doubleArray::>; @hint('call `.flatten()` on `doubleArray`') + Use the `suspects` array to `filter` to only "Hack Kerr"'s data -@test('1/06/04-concat') +@test('06/04-concat') @action(insert( ``` @@ -183,7 +183,7 @@ var newSuspects = ['Albert Gonzalez', 'Kevin Mitnick']; ``` `concat` the `newSuspects` onto the `suspects` list. -@test('1/06/05-concat') +@test('06/05-concat') @hint('call `suspects.concat()` with `newSuspects`') @onPageComplete('In the next step, we'll look at using one of the most powerful methods: `reduce`') diff --git a/tutorial/1/07/01-reduce.spec.js b/tutorial/07/01-reduce.spec.js similarity index 57% rename from tutorial/1/07/01-reduce.spec.js rename to tutorial/07/01-reduce.spec.js index 1f06527..0ebe757 100644 --- a/tutorial/1/07/01-reduce.spec.js +++ b/tutorial/07/01-reduce.spec.js @@ -2,13 +2,13 @@ var expect = require('chai').expect; // load('data/courses2.json', true) -// load('1/07/suspectData.js') +// load('07/suspectData.js') // load('07-reduce.js') describe('01 var total', function() { - it('should add the numbers up', function () { - expect(total).to.equal(54); - }); + it('should add the numbers up', function() { + expect(total).to.equal(54); + }); }); diff --git a/tutorial/1/07/02-reduce.spec.js b/tutorial/07/02-reduce.spec.js similarity index 100% rename from tutorial/1/07/02-reduce.spec.js rename to tutorial/07/02-reduce.spec.js diff --git a/tutorial/1/07/03-reduce.spec.js b/tutorial/07/03-reduce.spec.js similarity index 100% rename from tutorial/1/07/03-reduce.spec.js rename to tutorial/07/03-reduce.spec.js diff --git a/tutorial/1/07/04-reduce.spec.js b/tutorial/07/04-reduce.spec.js similarity index 100% rename from tutorial/1/07/04-reduce.spec.js rename to tutorial/07/04-reduce.spec.js diff --git a/tutorial/1/07/05-reduce.spec.js b/tutorial/07/05-reduce.spec.js similarity index 100% rename from tutorial/1/07/05-reduce.spec.js rename to tutorial/07/05-reduce.spec.js diff --git a/tutorial/1/07/06-reduce.spec.js b/tutorial/07/06-reduce.spec.js similarity index 100% rename from tutorial/1/07/06-reduce.spec.js rename to tutorial/07/06-reduce.spec.js diff --git a/tutorial/1/07/reduce.md b/tutorial/07/reduce.md similarity index 97% rename from tutorial/1/07/reduce.md rename to tutorial/07/reduce.md index c213f46..46e1358 100644 --- a/tutorial/1/07/reduce.md +++ b/tutorial/07/reduce.md @@ -49,7 +49,7 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp + Use `reduce` to sum the numbers in the `practice` array -@test('1/07/01-reduce') +@test('07/01-reduce') @action(open('07-reduce.js')) @action(set( ``` @@ -71,7 +71,7 @@ var total = practice.reduce(::>); + Not all reduce functions are so easy. `reduce` is a little more difficult to master. `map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages. -@test('1/07/02-reduce') +@test('07/02-reduce') @action(insert( ``` @@ -90,7 +90,7 @@ var averages = courses.map(function(course) { + `reduce` to an array of suspect scores from the `suspectData` we collected previously. -@test('1/07/03-reduce') +@test('07/03-reduce') @action(insert( ``` @@ -127,7 +127,7 @@ var suspectScores = suspectData.reduce(function(total, next) { difference: 15 }] ``` -@test('1/07/04-reduce') +@test('07/04-reduce') @action(insert( ``` @@ -151,7 +151,7 @@ var suspectStats = suspectScores.map(function(suspect) { + `reduce` down to likely suspect names by filtering with the `isCheater` function. This could be done with a `filter` & `map`, but it is simpler to just use one `reduce`. -@test('1/07/05-reduce') +@test('07/05-reduce') @action(insert( ``` @@ -166,7 +166,7 @@ var likelySuspects = suspectStats.reduce(function(::>) {}, []); @hint('use `.join(', ')`') + It looks like we have a likely suspect. -@test('1/07/06-reduce') +@test('07/06-reduce') @action(insert( ``` console.log(likelySuspects); diff --git a/tutorial/1/07/suspectData.js b/tutorial/07/suspectData.js similarity index 100% rename from tutorial/1/07/suspectData.js rename to tutorial/07/suspectData.js diff --git a/tutorial/1/08/01.spec.js b/tutorial/08/01.spec.js similarity index 100% rename from tutorial/1/08/01.spec.js rename to tutorial/08/01.spec.js diff --git a/tutorial/1/08/challenge-1.md b/tutorial/08/challenge-1.md similarity index 100% rename from tutorial/1/08/challenge-1.md rename to tutorial/08/challenge-1.md diff --git a/tutorial/1/09/challenge-2.md b/tutorial/09/challenge-2.md similarity index 100% rename from tutorial/1/09/challenge-2.md rename to tutorial/09/challenge-2.md diff --git a/tutorial/1/02/01-sort.spec.js b/tutorial/1/02/01-sort.spec.js deleted file mode 100644 index 5da2a7f..0000000 --- a/tutorial/1/02/01-sort.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -var expect = require('chai').expect; - -// load('1/02/myBest.js', true) -// load('02-sort.js') - -describe('01 function compareScore', function () { - it('doesn\'t exist', function() { - expect(compareScore).to.not.be.undefined; - }); - - it('isn\'t a Function', function() { - expect(compareScore).to.be.a('function'); - }); - - it('doesn\'t have two params', function() { - expect(compareScore.length).to.equal(2); - }); - - it('doesn\'t return 1 when b\'s score is more than a\'s', function() { - expect(compareScore({score: 3}, {score: 5})).to.equal(1); - }); -}); diff --git a/tutorial/1/03/01-map.spec.js b/tutorial/1/03/01-map.spec.js deleted file mode 100644 index 80e392b..0000000 --- a/tutorial/1/03/01-map.spec.js +++ /dev/null @@ -1,53 +0,0 @@ -var expect = require('chai').expect; - -// load('1/03/myData.js', true) -// load('03-map.js') - -describe('01 function changeGrade', function() { - - it('doesn\'t exist', function() { - expect(changeGrade).to.not.be.undefined; - }); - - it('isn\'t a function', function() { - expect(changeGrade).to.be.a('function'); - }); - - it('should take a parameter', function() { - expect(changeGrade).to.have.length(1); - }); - - it('should try changing `student.grade` first before returning `student`', function () { - var regex = /return [a-zA-Z]+\.grade/; - var func = changeGrade.toString(); - expect(func.match(regex)).to.be.null; - }); - - it('should change grades from a D to an A', function() { - var test = { - grade: 'D' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - - it('should change grades from a F to an A', function() { - var test = { - grade: 'F' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - - it('should change grades from a B to an A', function() { - var test = { - grade: 'B' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - -}); diff --git a/tutorial/1/04/01-forEach.spec.js b/tutorial/1/04/01-forEach.spec.js deleted file mode 100644 index 8444ec5..0000000 --- a/tutorial/1/04/01-forEach.spec.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; -var chai = require('chai'); -var spies = require('chai-spies'); -var expect = chai.expect; -chai.use(spies); - -// load('1/04/myFixed.js', true) -if (process.env.TASK_POSITION === '4') { - myFixed = []; -} -var spy = chai.spy.on(console, 'log'); -// load('04-forEach.js') - -describe('01 console.log', function() { - - if (process.env.TASK_POSITION !== '4') { - it('should be called 10 times', function() { - expect(spy).to.have.been.called.with('A 95 Relational Databases'); - expect(spy).to.have.been.called.with('C 77 Networks'); - }); - } - -}); diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index 7a79fb2..b2f147e 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -8,13 +8,13 @@ Keywords: javascript, functional Length: 1-2 hours -@import('1/00/setup') -@import('1/01/filter') -@import('1/02/sort') -@import('1/03/map') -@import('1/04/forEach') -@import('1/05/find') -@import('1/06/concat') -@import('1/07/reduce') -@import('1/08/challenge-1') -@import('1/09/challenge-2') +@import('00/setup') +@import('01/filter') +@import('02/sort') +@import('03/map') +@import('04/forEach') +@import('05/find') +@import('06/concat') +@import('07/reduce') +@import('08/challenge-1') +@import('09/challenge-2') From 5e53139b07a70dc04f01d9a06e370bf47c15e4a1 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 3 May 2016 13:45:36 -0700 Subject: [PATCH 20/46] update .gitignore --- .gitignore | 2 +- tutorial/.tmp.spec.js | 72 ------------------------------------------- 2 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 tutorial/.tmp.spec.js diff --git a/.gitignore b/.gitignore index d949b23..e11dc98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules dev -tutorial/_tmp.js +tutorial/.tmp.* diff --git a/tutorial/.tmp.spec.js b/tutorial/.tmp.spec.js deleted file mode 100644 index b285593..0000000 --- a/tutorial/.tmp.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -var chai = require('chai'); -var spies = require('chai-spies'); -var expect = chai.expect; -chai.use(spies); -var spy = chai.spy.on(console, 'log'); - -var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; - -// Welcome to CodeRoad! - -var first = students[0]; -var myName = first.name; -console.log(myName); - - -describe('01 first', function() { - - it('should exist', function() { - expect(first).to.be.defined; - }); - - it('should be an object', function() { - expect(first).to.be.an('object'); - }); - - it('should take have property title', function() { - expect(first).to.have.property('title'); - }); - - it('should have the correct value', function() { - var result = { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" - }; - expect(first).to.deep.equal(result); - }); - -}); - -describe('02 myName', function () { - - it('should exist', function () { - expect(myName).to.be.defined; - }); - - it('should be a string', function () { - expect(myName).to.be.a('string'); - }); - - it('should have the correct value', function () { - var result = 'Ada Lovelace'; - expect(myName).to.deep.equal(result); - }); - -}); - -describe('03 console.log', function() { - - it('should use `console.log` to log the name', function() { - expect(spy).to.have.been.called(); - }) - - it('should log `myName` to the console', function() { - expect(spy).to.have.been.called.with('Ada Lovelace'); - }); - -}); - From a24f9d5995716e1ad42248d04b51ce26b412a42b Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 4 Jul 2016 19:44:07 -0700 Subject: [PATCH 21/46] add new config properties: language --- coderoad.json | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/coderoad.json b/coderoad.json index 8c5de7f..0b2b262 100644 --- a/coderoad.json +++ b/coderoad.json @@ -28,7 +28,7 @@ "00/02-setup" ], "actions": [ - "insert('var myName= ::>\n')" + "insert('var myName = ::>\n')" ], "hints": [ "Get the first \"name\" in the students using the array index", diff --git a/package.json b/package.json index 84b64db..fda4256 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.5.0", + "version": "0.5.1", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -32,6 +32,7 @@ }, "license": "MIT", "config": { + "language": "JS", "dir": "tutorial", "testSuffix": ".spec.js", "runner": "mocha-coderoad", From 6a20beaaf7d2a9f0e0781bb4444633b7bf2f7d3e Mon Sep 17 00:00:00 2001 From: ShMcK Date: Sat, 16 Jul 2016 15:16:39 -0700 Subject: [PATCH 22/46] update mocha & test runner --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fda4256..84799c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.5.1", + "version": "0.5.2", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -27,8 +27,8 @@ "dependencies": { "chai": "3.5.0", "chai-spies": "0.7.1", - "mocha": "2.4.5", - "mocha-coderoad": "^0.6.0" + "mocha": "^2.5.3", + "mocha-coderoad": "^0.8.1" }, "license": "MIT", "config": { From a5feaf88a6b4e83c93a78820e601738b5bb0bfce Mon Sep 17 00:00:00 2001 From: ShMcK Date: Sun, 17 Jul 2016 09:47:17 -0700 Subject: [PATCH 23/46] change first insert to set, to avoid bug in ch2 --- coderoad.json | 2 +- package.json | 2 +- tutorial/01/filter.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coderoad.json b/coderoad.json index 0b2b262..2c9203d 100644 --- a/coderoad.json +++ b/coderoad.json @@ -63,7 +63,7 @@ ], "actions": [ "open('01-filter.js')", - "insert('// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" + "set('// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" ], "hints": [ "Some tasks have hints", diff --git a/package.json b/package.json index 84799c7..c9531d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.5.2", + "version": "0.5.3", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index a66b1d5..cc048f3 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -54,7 +54,7 @@ console.log(students[0]); + Write a filter condition function called `isAda` that returns true only if the name matches your name: "Ada Lovelace". @test('01/01-filter') @action(open('01-filter.js')) -@action(insert( +@action(set( ``` // Array.filter(fn) From 7816560c74868de0e7f877e98405e9a6c7a26026 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:15:05 -0700 Subject: [PATCH 24/46] remake step 00 for mocha-coderoad@0.10 --- tutorial/00/01-setup.spec.js | 36 ------------------------------------ tutorial/00/01.js | 18 ++++++++++++++++++ tutorial/00/02-setup.spec.js | 16 ---------------- tutorial/00/02.js | 31 +++++++++++++++++++++++++++++++ tutorial/00/03-setup.spec.js | 11 ----------- tutorial/00/03.js | 19 +++++++++++++++++++ tutorial/00/04.js | 11 +++++++++++ tutorial/00/setup.md | 18 +++++++++++++++--- 8 files changed, 94 insertions(+), 66 deletions(-) delete mode 100644 tutorial/00/01-setup.spec.js create mode 100644 tutorial/00/01.js delete mode 100644 tutorial/00/02-setup.spec.js create mode 100644 tutorial/00/02.js delete mode 100644 tutorial/00/03-setup.spec.js create mode 100644 tutorial/00/03.js create mode 100644 tutorial/00/04.js diff --git a/tutorial/00/01-setup.spec.js b/tutorial/00/01-setup.spec.js deleted file mode 100644 index d8bedc1..0000000 --- a/tutorial/00/01-setup.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -var chai = require('chai'); -var spies = require('chai-spies'); -var expect = chai.expect; -chai.use(spies); -var spy = chai.spy.on(console, 'log'); - -// load('data/students.js', true) -// load('00-setup.js') - -describe('01 first', function() { - - it('should exist', function() { - expect(first).to.be.defined; - }); - - it('should be an object', function() { - expect(first).to.be.an('object'); - }); - - it('should take have property title', function() { - expect(first).to.have.property('title'); - }); - - it('should have the correct value', function() { - var result = { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" - }; - expect(first).to.deep.equal(result); - }); - -}); diff --git a/tutorial/00/01.js b/tutorial/00/01.js new file mode 100644 index 0000000..bd112ed --- /dev/null +++ b/tutorial/00/01.js @@ -0,0 +1,18 @@ +'use strict'; +var chai = require('chai'); +var spies = require('chai-spies'); +var expect = chai.expect; +chai.use(spies); +var spy = chai.spy.on(console, 'log'); + +console.log(chai); + +describe('01 student data', () => { + + const students = require('BASE/students.js'); + + it('should be loaded in "students.js"', () => { + expect(students).to.be.defined; + }); + +}) diff --git a/tutorial/00/02-setup.spec.js b/tutorial/00/02-setup.spec.js deleted file mode 100644 index 48b29d0..0000000 --- a/tutorial/00/02-setup.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('02 myName', function () { - - it('should exist', function () { - expect(myName).to.be.defined; - }); - - it('should be a string', function () { - expect(myName).to.be.a('string'); - }); - - it('should have the correct value', function () { - var result = 'Ada Lovelace'; - expect(myName).to.deep.equal(result); - }); - -}); diff --git a/tutorial/00/02.js b/tutorial/00/02.js new file mode 100644 index 0000000..541c85a --- /dev/null +++ b/tutorial/00/02.js @@ -0,0 +1,31 @@ +const setup = require('BASE/00-setup.js'); + +describe('02 first', () => { + + // __get__ grabs global first + const first = setup.__get__('first'); + + it('should exist', () => { + expect(first).to.be.defined; + }); + + it('should be an object', () => { + expect(first).to.be.an('object'); + }); + + it('should take have property title', () => { + expect(first).to.have.property('title'); + }); + + it('should have the correct value', () => { + var result = { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }; + expect(first).to.deep.equal(result); + }); + +}); diff --git a/tutorial/00/03-setup.spec.js b/tutorial/00/03-setup.spec.js deleted file mode 100644 index 3b29517..0000000 --- a/tutorial/00/03-setup.spec.js +++ /dev/null @@ -1,11 +0,0 @@ -describe('03 console.log', function() { - - it('should use `console.log` to log the name', function() { - expect(spy).to.have.been.called(); - }) - - it('should log `myName` to the console', function() { - expect(spy).to.have.been.called.with('Ada Lovelace'); - }); - -}); diff --git a/tutorial/00/03.js b/tutorial/00/03.js new file mode 100644 index 0000000..d952be8 --- /dev/null +++ b/tutorial/00/03.js @@ -0,0 +1,19 @@ +describe('03 myName', () => { + + // __get__ grabs global myName + const myName = setup.__get__('myName'); + + it('should exist', () => { + expect(myName).to.be.defined; + }); + + it('should be a string', () => { + expect(myName).to.be.a('string'); + }); + + it('should have the correct value', () => { + const result = 'Ada Lovelace'; + expect(myName).to.deep.equal(result); + }); + +}); diff --git a/tutorial/00/04.js b/tutorial/00/04.js new file mode 100644 index 0000000..15f3aa7 --- /dev/null +++ b/tutorial/00/04.js @@ -0,0 +1,11 @@ +describe('04 console.log', () => { + + it('should use `console.log` to log the name', () => { + expect(spy).to.have.been.called(); + }) + + it('should log `myName` to the console', () => { + expect(spy).to.have.been.called.with('Ada Lovelace'); + }); + +}); diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index e83dca4..0577cd6 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -25,12 +25,24 @@ console.log( // first instructor Sean Quentin Lewis ``` ++ Load the student data into "students.js" +@test('00/01') +@action(open('students.js')) +@action(set( +``` +var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; +export default students; +``` +)) + + + Set `first` to the first item in the `students` array. -@test('00/01-setup') +@test('00/02') @action(open('00-setup.js')) @action(set( ``` // Welcome to CodeRoad! +import students from './students'; var first = ::> ``` @@ -40,7 +52,7 @@ var first = ::> + Set `myName` to the "name" of the first student in the list. -@test('00/02-setup') +@test('00/03') @action(insert( ``` var myName = ::> @@ -51,7 +63,7 @@ var myName = ::> @hint('Try `first.name`') + Log your name to the console. -@test('00/03-setup') +@test('00/04') @action(insert( ``` From edfacb0b5ba9b01bb09d9a05dfe1e99413bb2b98 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:20:11 -0700 Subject: [PATCH 25/46] update step 1 --- CHANGELOG.md | 3 + README.md | 436 +------------------- coderoad.json | 491 +---------------------- package.json | 4 +- tutorial/00/01.js | 10 +- tutorial/01/01-filter.spec.js | 52 --- tutorial/01/01.js | 53 +++ tutorial/01/{02-filter.spec.js => 02.js} | 13 +- tutorial/01/{03-filter.spec.js => 03.js} | 15 +- tutorial/01/{04-filter.spec.js => 04.js} | 13 +- tutorial/01/filter.md | 8 +- tutorial/tutorial.md | 16 +- 12 files changed, 119 insertions(+), 995 deletions(-) delete mode 100644 tutorial/01/01-filter.spec.js create mode 100644 tutorial/01/01.js rename tutorial/01/{02-filter.spec.js => 02.js} (84%) rename tutorial/01/{03-filter.spec.js => 03.js} (63%) rename tutorial/01/{04-filter.spec.js => 04.js} (79%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6f70f9..3b0f070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.6.0] - 2016-08-06 +- update for mocha-coderoad v0.10: no more loaders + ## [0.5.0] - 2016-05-02 - remove "chapters" diff --git a/README.md b/README.md index 4494c27..542319b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,17 @@ Keywords: javascript, functional Length: 1-2 hours + + + + + + + + + + + ## CodeRoad CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. Learn more at [CodeRoad.io](http://coderoad.io). @@ -52,428 +63,3 @@ console.log( ); // first instructor Sean Quentin Lewis ``` - -##### Filter - -Array -> Array of items that match a condition - -You've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card. - -It would be great if you could `filter` the scores that your parents will see. - -`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below: - -``` -function isA(x) { - return x === 'a'; -} -``` - - -Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). - -``` -var list = ['a', 'b']; -list.filter(isA); - -// if isA(list[0]), add to output array -// if isA(list[1]), add to output array -// -//> ['a'] -``` - -If your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below. - -``` -function isB(x) { - return x.item === 'b' -} - -var list = [{item: 'a'}, {item: 'b'}]; -list.filter(isB); -//> [{item: 'b'}] -``` - -Where were we? Back to filtering our grades. - -There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: - -``` -console.log(students[0]); -//> { course: 'Web Security', -// instructor: 'Sue Denim', -// name: 'Rebecca Heineman', -// score: 93, -// grade: 'A' } -``` - -##### Sort - -Array -> sorted Array - -Your grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through. - -You can use the array method `sort` to arrange your data. Let's see how it works. - -```js -['c', 'b', 'a'].sort(); -//> ['a', 'b', 'c'] - -[3, 2, 1].sort(); -//> [1, 2, 3] -``` - -But what about sorting scores inside of an object? - -```js -[{a: 3}, {a: 1}, {a: 2}].sort(); -//> [{a: 3}, {a: 1}, {a: 2}] -``` - -That didn't work. Instead, you can write a custom `compareScore` function. - -A sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array: - - * -1 : sort to a lower index (front) - * 1 : sort to a higher index (back) - * 0 : stay the same - -Alright, now time to sort your best grades to the top. - -First you'll need to write a sort condition function called `compareScore`. - -##### Map - -Array -> run a function over each item -> Array - -You've filtered and sorted our data, but neither of those actually change the data. - -Wouldn't it be simpler if you could just change your grades? - -You can use the array method `map` to run a function that returns changes to your data. - -As an example, let's look at how you would increment each number in an array. - -```js -function addOne(num) { - return num + 1; -} - -[1, 2, 3].map(addOne); -//> [2, 3, 4] - -function addToVal(obj) { - obj.val += 1; - return obj; -} -[{ val: 1}].map(addToVal); -//> [{ val: 2 }] -``` - -`map` can change data, and it can also alter structure of the data you're working with. - -```js -function makeObject(num) { - return { val: num }; -} - -[1, 2].map(makeObject); -//> [{ val: 1 }, { val: 2 }] -``` - -Similarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted. - -```js -myBest - .map(function(student) { - return student.score; - }) - .sort() - .reverse() -//> [93, 91, 88, 88, 82, 81, 73] -``` - -In this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores. - -`map` is powerful. Let's see what you can do with it. - -Those D & F grades would look a lot better if they suddenly became A's. - -Let's go back to before we filtered out the bad grades, and instead change the grades to A's. - -##### forEach - -Array -> run a function for each item - -You've updated your grades, but they're still in an array. It's time to loop over them and log them to the console. - -To open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows. - -`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between: - - * **functional** & **imperative** programming - * **pure** & **impure** functions - -Know it or not, you're probably already used to "imperative" programming. - -> **Imperative** programming describes the order of actions - -Imperative code tells the computer what to do, step by step. - -```js -var x = 1; // make a variable -x = x + 1; // add one -x = x + 1; // add another -console.log(x); -//> 3 -``` - -> **Functional** programming describes the data transformation - -Functional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2. - -In the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time. - -```js -// a pure function -function addOne(x) { - return x + 1; -} -addOne(1) -//> 2 -addOne(1) -//> 2 -``` - -A function is "pure" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier. - -On the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time. - -```js -var y = 1; -// impure function -function increment(x) { - y += x; - return y; -} -increment(1) -//> 2 -increment(1) -//> 3 -``` - -It's good practice to ensure your `map` functions remain pure. - -But `forEach` can be a little more dangerous. Why? Let's have a look. - -```js -[1, 2, 3].map(addOne); -//> [2, 3, 4] - -[1, 2, 3].forEach(addOne); -//> undefined -``` - -What? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed. - -```js -// impure function, changes log -function addOneToLog(x) { - console.log(x); -} - -[1, 2, 3].forEach(addOneToLog); -//> 2 -//> 3 -//> 4 -``` - -Now that we see how `forEach` works, let's use it to make calls to the `console`. - -##### find - -Array -> first element that matches a condition - -Somehow your name has disappeared from the computer system. We'll have to `find` a way to get it back. - -You quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list. - -`find` works similar to `filter`, but returns only the first match. - -``` -var data = [1, 2, 3, 4, 5, 6]; - -function isEven(num) { - return num % 2 === 0; -} - -// returns all matching data to a condition -data.filter(isEven); -//> [2, 4, 6] - -// returns the first match -data.find(isEven); -//> [2] -``` - -Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. - -##### concat - -Array + Array -> Array - -Before we've been working on a structured set of student data. - -```js -// array of students -[ - { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Rebecca Heineman", - "score": 71, - "grade": "C" - } -// students in courses... -] -``` - -To be safe, let's now work on the original data set. Notice how it is structured differently. - -```js -// array of courses -[ - { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "students": [ - { - "name": "Rebecca Heineman", - "score": 71, - "grade": "C" - } - // students... - ] - } - // courses... -] -``` - -In this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses? - -Weird things happen when you start combining arrays. We can use `concat` to bring sanity. - -```js -[1, 2] + [3, 4]; -//> "1, 23, 4" - -[1, 2].push([3, 4]); -//> 3 - -[1, 2].join([3, 4]); -//> "13, 42" - -[1, 2].concat([3, 4]); -//> [1, 2, 3, 4] -``` - -Unfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`). - -`flatten` should loop over an array and `concat` each element. - -Let's look at an abstraction of what we need to do: - -```js -var start = [{ - a: 1, - c: [ - { b: 1 } - ] -}, { - a: 2, - c: [ - { b: 2 }, { b: 3 } - ] -}]; - -var middle = start.map(function(outer) { - return outer.c.map(function(inner) { - return { - a: outer.a, - b: inner.b - }; - }); -}); -//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ] - -var end = pre.flatten(); -//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}] -``` - -Back to business. - -We have a suspect in mind: a classmate named "Hack Kerr". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name. - -We'll test out flatten, then re-create our student array of data from the original course data. - -##### reduce - -Array -> anything - -We know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades. - -You can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations. - -`map` has a major limitation: it will always output the same number of elements as the input array. - -When you want to transform data into something different, you'll likely want to use `reduce`. - -Reduce requires two parameters: - - * the running total (set by an initialValue) - * the next value in the array - -```js -function add(total, next) { - console.log(`add(${total}, ${next}) -> ${total + next}`) - return total + next -} - -var initialValue = 100; -[1, 5, 10].reduce(add, initialValue); // initial value - -// add(100, 1) -> 101 -// add(101, 5) -> 106 -// add(106, 10) -> 116 -//> 116 -``` - -Notice in the example we input an array of 3 items and output a single number. The data has been transformed. - -It takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere. - -You may have noticed we've already used `reduce` to `flatten` our arrays. - -```js -Array.prototype.flatten = function() { - return this.reduce(function(a, b) { - return a.concat(b); - }, []); -}; -``` - -With `flatten`, the initialValue was set to an empty array which each value was `concat` onto. - -Do some practice with `reduce`, before you use it to narrow down a cheating suspect. - -##### Challenge 1 - -coming soon - -You'd better fix your name and scores back to the way they were. - -##### Challenge 2 - -coming soon - -It's time to get revenge. diff --git a/coderoad.json b/coderoad.json index 2c9203d..87e8380 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,21 +1,31 @@ { "info": { "title": "Functional School", - "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours" + "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n\n\n\n\n\n\n\n" }, "pages": [ { "title": "Start", "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", "tasks": [ + { + "description": "Load the student data into \"students.js\"", + "tests": [ + "00/01" + ], + "actions": [ + "open('students.js')", + "set('var students=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Brian Kernaghan\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Grace Hopper\",score:36,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"James Gosling\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ken Thompson\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Linus Torvalds\",score:34,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n')" + ] + }, { "description": "Set `first` to the first item in the `students` array.", "tests": [ - "00/01-setup" + "00/02" ], "actions": [ "open('00-setup.js')", - "set('// Welcome to CodeRoad!\n\nvar first = ::>\n')" + "set('// Welcome to CodeRoad!\nimport students from './students';\n\nvar first = ::>\n')" ], "hints": [ "Get the first item in students using the array index", @@ -25,7 +35,7 @@ { "description": "Set `myName` to the \"name\" of the first student in the list.", "tests": [ - "00/02-setup" + "00/03" ], "actions": [ "insert('var myName = ::>\n')" @@ -39,7 +49,7 @@ { "description": "Log your name to the console.", "tests": [ - "00/03-setup" + "00/04" ], "actions": [ "insert('\nconsole.log(::>);\n')" @@ -51,477 +61,6 @@ } ], "onPageComplete": "Now we're ready to get started with `filter`ing our data." - }, - { - "title": "Filter", - "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", - "tasks": [ - { - "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", - "tests": [ - "01/01-filter" - ], - "actions": [ - "open('01-filter.js')", - "set('// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" - ], - "hints": [ - "Some tasks have hints", - "Check if `student.name` matches \"Ada Lovelace\"", - "Use `===` to check equality" - ] - }, - { - "description": "Set `var myData` to filter with the `isAda` function.", - "tests": [ - "01/02-filter" - ], - "actions": [ - "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" - ], - "hints": [ - "Add a function to the `filter` call: `Array.filter(function() {})`", - "Pass `isAda` into your `filter` call" - ] - }, - { - "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", - "tests": [ - "01/03-filter" - ], - "actions": [ - "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" - ], - "hints": [ - "match for `student.grade` that isn't \"D\" or \"F\"", - "use `!==` to check non-equality", - "Match for both: `student.grade !== \"D\" && student.grade !== \"F\"`" - ] - }, - { - "description": "Set `var myBest` to your scores, excluding any grades that are \"D\" or \"F\".", - "tests": [ - "1/01/04-filter" - ], - "actions": [ - "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter(::>);\n\n')" - ] - } - ], - "onPageComplete": "In the next step we'll look at how to `sort` data" - }, - { - "title": "Sort", - "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", - "tasks": [ - { - "description": "`compareScore` should return 1 if the first score is less than the second", - "tests": [ - "02/01-sort" - ], - "actions": [ - "open('02-sort.js')", - "set('// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" - ] - }, - { - "description": "`compareScore` should return -1 if the first score is more than the second", - "tests": [ - "02/02-sort" - ], - "hints": [ - "set the second case to `b.score < a.score`" - ] - }, - { - "description": "`compareScore` should return 0 if the first score is the same as the second", - "tests": [ - "02/03-sort" - ], - "hints": [ - "no case is necessary, use the `default` case" - ] - }, - { - "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", - "tests": [ - "02/04-sort" - ], - "actions": [ - "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" - ], - "hints": [ - "try using `myBest.sort()`" - ] - } - ], - "onPageComplete": "In the next step we'll look at changing data with `map`" - }, - { - "title": "Map", - "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", - "tasks": [ - { - "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", - "tests": [ - "03/01-map" - ], - "actions": [ - "open('03-map.js')", - "set('// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" - ], - "hints": [ - "give `changeGrade` a parameter, call it \"student\"", - "match for `student.grade`", - "match where `student.grade === 'A'`" - ] - }, - { - "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", - "tests": [ - "03/02-map" - ], - "actions": [ - "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" - ] - }, - { - "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myData` and instead increment each score by 12 points.", - "tests": [ - "03/03-map" - ], - "actions": [ - "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" - ], - "hints": [ - "give `increaseScore` a parameter, call it \"student\"", - "it should increase `student.score`", - "return `student`" - ] - }, - { - "description": "Wait. Now you're getting 105 in \"Algorithm Design\" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious.", - "tests": [ - "1/03/04-map" - ], - "hints": [ - "use an if clause within `increaseScore`", - "try `if (student.score >= 95) { student.score = 95 }`" - ] - }, - { - "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores.", - "tests": [ - "03/05-map" - ], - "actions": [ - "insert('\n// change `getGrade` to accept an object\n// and return an object\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nvar myFixed = mySlightlyChanged;\n')" - ], - "hints": [ - "change `getGrade` to take a `student` param instead of `score`", - "change the grade and return the `student`", - "set `student.grade = \"A\"` and return `student`" - ] - }, - { - "description": "Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only.", - "tests": [ - "03/06-map" - ], - "actions": [ - "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" - ], - "hints": [ - "use `map` to return only the \"score\" & \"grade\" fields", - "map with a function with a parameter, call it \"student\"", - "return `{ score: student.score, grade: student.grade }`" - ] - } - ], - "onPageComplete": "In the next step we'll compare `map` with `forEach`" - }, - { - "title": "forEach", - "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nvar x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nvar y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", - "tasks": [ - { - "description": "Use `forEach` to log out your report card to the console", - "tests": [ - "04/01-forEach" - ], - "actions": [ - "open('04-forEach.js')", - "set('// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" - ], - "hints": [ - "call `forEach` with `logCourse`" - ] - }, - { - "description": "Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`.", - "tests": [ - "04/02-forEach" - ], - "actions": [ - "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course::>) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" - ], - "hints": [ - "Array methods can take more than one parameter", - "Add a second parameter to `logCourseWithIndex`" - ] - }, - { - "description": "Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`.", - "tests": [ - "04/03-forEach" - ], - "actions": [ - "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index::>) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" - ], - "hints": [ - "Array methods can take more than one parameter", - "Add a third parameter to `logCourseWithIndexAndArray`" - ] - }, - { - "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.", - "tests": [ - "04/04-forEach" - ], - "actions": [ - "insert('\nconsole.log(myFixed);\n')" - ] - } - ], - "onPageComplete": "Something strange is going on. In the next step we'll try to `find` your data." - }, - { - "title": "find", - "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nvar data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", - "tasks": [ - { - "description": "`filter` to `students` in the class titled \"Web Security\"", - "tests": [ - "05/01-find" - ], - "actions": [ - "open('05-find.js')", - "set('// Array.find(fn)\n\n// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" - ], - "hints": [ - "create a `filter` function", - "filter for `student.title === \"Web Security\"`" - ] - }, - { - "description": "`find` the name in `myClass` that isn't in the list of known students", - "tests": [ - "05/02-find" - ], - "actions": [ - "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", - "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" - ], - "hints": [ - "use `indexOf` to find what doesn't match", - "use `otherStudents.indexOf(x) === -1` to find what doesn't match", - "match for `student.name`" - ] - }, - { - "description": "`filter` down to students without known names", - "tests": [ - "05/03-find" - ], - "actions": [ - "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" - ], - "hints": [ - "consider reusing a function" - ] - }, - { - "description": "`map` over the result to get only the `name` property", - "tests": [ - "05/04-find" - ], - "actions": [ - "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" - ], - "hints": [ - "use `map` to return only the `student.name`" - ] - }, - { - "description": "`join('')` the array of names to output the result as a string", - "tests": [ - "05/05-find" - ], - "actions": [ - "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" - ], - "hints": [ - "call `join` following `unknownStudentNames`" - ] - } - ], - "onPageComplete": "Very strange. In the next step, let's find out who wants revenge, and give it to him!" - }, - { - "title": "concat", - "description": "Array + Array -> Array\n\nBefore we've been working on a structured set of student data.\n\n```js\n// array of students\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n// students in courses...\n]\n```\n\nTo be safe, let's now work on the original data set. Notice how it is structured differently.\n\n```js\n// array of courses\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"students\": [\n {\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n // students...\n ]\n }\n // courses...\n]\n```\n\nIn this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses?\n\nWeird things happen when you start combining arrays. We can use `concat` to bring sanity.\n\n```js\n[1, 2] + [3, 4];\n//> \"1, 23, 4\"\n\n[1, 2].push([3, 4]);\n//> 3\n\n[1, 2].join([3, 4]);\n//> \"13, 42\"\n\n[1, 2].concat([3, 4]);\n//> [1, 2, 3, 4]\n```\n\nUnfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`).\n\n`flatten` should loop over an array and `concat` each element.\n\nLet's look at an abstraction of what we need to do:\n\n```js\nvar start = [{\n a: 1,\n c: [\n { b: 1 }\n ]\n}, {\n a: 2,\n c: [\n { b: 2 }, { b: 3 }\n ]\n}];\n\nvar middle = start.map(function(outer) {\n return outer.c.map(function(inner) {\n return {\n a: outer.a,\n b: inner.b\n };\n });\n});\n//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ]\n\nvar end = pre.flatten();\n//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}]\n```\n\nBack to business.\n\nWe have a suspect in mind: a classmate named \"Hack Kerr\". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name.\n\nWe'll test out flatten, then re-create our student array of data from the original course data.", - "tasks": [ - { - "description": "First, test out `flatten` on the `flattenedArray`", - "tests": [ - "06/01-concat" - ], - "actions": [ - "open('06-concat.js')", - "set('// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", - "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" - ], - "hints": [ - "call `.flatten()` on `numberedList`" - ] - }, - { - "description": "Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score", - "tests": [ - "06/02-concat" - ], - "actions": [ - "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" - ], - "hints": [ - "pair `course.title`", - "pair `student.name`" - ] - }, - { - "description": "Use `flatten` to put all data into a single array. Set `students` to the result.", - "tests": [ - "06/03-concat" - ], - "actions": [ - "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" - ], - "hints": [ - "call `.flatten()` on `doubleArray`" - ] - }, - { - "description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data", - "tests": [ - "06/04-concat" - ], - "actions": [ - "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" - ] - }, - { - "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nvar newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", - "tests": [ - "06/05-concat" - ], - "hints": [ - "call `suspects.concat()` with `newSuspects`" - ] - } - ], - "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" - }, - { - "title": "reduce", - "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nvar initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", - "tasks": [ - { - "description": "Use `reduce` to sum the numbers in the `practice` array", - "tests": [ - "07/01-reduce" - ], - "actions": [ - "open('07-reduce.js')", - "set('// Array.reduce(fn(a, b), initialValue)\n\nvar practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" - ], - "hints": [ - "with only numbers, the initialValue defaults to 0", - "just call `reduce` with `add`" - ] - }, - { - "description": "Not all reduce functions are so easy. `reduce` is a little more difficult to master.\n\n`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages.", - "tests": [ - "07/02-reduce" - ], - "actions": [ - "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" - ], - "hints": [ - "set the initialValue to 0", - "like this: `reduce(function () {}, 0)`", - "return the sum of `student.score` and `total`" - ] - }, - { - "description": "`reduce` to an array of suspect scores from the `suspectData` we collected previously.", - "tests": [ - "07/03-reduce" - ], - "actions": [ - "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" - ], - "hints": [ - "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", - "match for `next.name` & `next.score`", - "you can concat the scores onto an array: `[].concat(next.score)`", - "if the name is already in the list, just add the `next.score`" - ] - }, - { - "description": "`map` over suspect data to find the `\"difference\"` from subtracting the students score from the average score. Add this to `suspectScores` using the key `difference`. The resulting array should look like this:\n```js\n[{\n name: 'suspectName',\n scores: [50, 65, 75 ...],\n difference: 15\n}]\n```", - "tests": [ - "07/04-reduce" - ], - "actions": [ - "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" - ], - "hints": [ - "You may want to use a second param: `index`", - "Compare the `suspect.scores[index]` with the `averages[index]`", - "To get a sum, start your `reduce` function at 0" - ] - }, - { - "description": "`reduce` down to likely suspect names by filtering with the `isCheater` function.\n\nThis could be done with a `filter` & `map`, but it is simpler to just use one `reduce`.", - "tests": [ - "07/05-reduce" - ], - "actions": [ - "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" - ], - "hints": [ - "use `.join(', ')`" - ] - }, - { - "description": "It looks like we have a likely suspect.", - "tests": [ - "07/06-reduce" - ], - "actions": [ - "insert('console.log(likelySuspects);\n')" - ] - } - ] - }, - { - "title": "Challenge 1", - "description": "coming soon\n\nYou'd better fix your name and scores back to the way they were." - }, - { - "title": "Challenge 2", - "description": "coming soon\n\nIt's time to get revenge." } ] } \ No newline at end of file diff --git a/package.json b/package.json index c9531d9..4150eee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.5.3", + "version": "0.6.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -34,7 +34,7 @@ "config": { "language": "JS", "dir": "tutorial", - "testSuffix": ".spec.js", + "testSuffix": ".js", "runner": "mocha-coderoad", "edit": true } diff --git a/tutorial/00/01.js b/tutorial/00/01.js index bd112ed..2fbb00a 100644 --- a/tutorial/00/01.js +++ b/tutorial/00/01.js @@ -1,11 +1,9 @@ 'use strict'; -var chai = require('chai'); -var spies = require('chai-spies'); -var expect = chai.expect; +const chai = require('chai'); +const spies = require('chai-spies'); +const expect = chai.expect; chai.use(spies); -var spy = chai.spy.on(console, 'log'); - -console.log(chai); +let spy = chai.spy.on(console, 'log'); describe('01 student data', () => { diff --git a/tutorial/01/01-filter.spec.js b/tutorial/01/01-filter.spec.js deleted file mode 100644 index a7b1a92..0000000 --- a/tutorial/01/01-filter.spec.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -var expect = require('chai').expect; - -// load('data/students.js', true) -// load('01-filter.js') - -describe('01 function isAda', function() { - - it('doesn\'t exist', function() { - expect(isAda).to.not.be.undefined; - }); - - it('isn\'t a Function', function() { - expect(isAda).to.be.a('function'); - }); - - it('doesn\'t take a parameter', function() { - expect(isAda).to.have.length(1); - }); - - it('doesn\'t return a boolean', function () { - expect(isAda({name: 'Ada'})).to.be.a('boolean'); - }); - - it('should match for name', function () { - let regex1 = /\.name/; - let regex2 = /\[.name.\]/; - let string = isAda.toString(); - let result = !!string.match(regex1) || !!string.match(regex2); - expect(result).to.be.true; - }); - - it('requires the full name "Ada Lovelace"', function () { - let regex = /Ada Lovelace/; - let string = isAda.toString(); - expect(!!string.match(regex)).to.be.true; - }); - - it('doesn\'t match student.name to "Ada Lovelace"', function() { - let test = [{ - name: 'Jane' - }, { - name: 'Joe' - }, { - name: 'Ada Lovelace' - }]; - expect(test.filter(isAda)).to.deep.equal([{ - name: "Ada Lovelace" - }]); - }); - -}); diff --git a/tutorial/01/01.js b/tutorial/01/01.js new file mode 100644 index 0000000..35316d2 --- /dev/null +++ b/tutorial/01/01.js @@ -0,0 +1,53 @@ +'use strict'; +var expect = require('chai').expect; + +const filter = require('BASE/01-filter.js'); + +describe('01 function isAda', () => { + + const isAda = filter.__get__('isAda'); + + it('doesn\'t exist', () => { + expect(isAda).to.not.be.undefined; + }); + + it('isn\'t a Function', () => { + expect(isAda).to.be.a('function'); + }); + + it('doesn\'t take a parameter', () => { + expect(isAda).to.have.length(1); + }); + + it('doesn\'t return a boolean', () => { + expect(isAda({name: 'Ada'})).to.be.a('boolean'); + }); + + it('should match for name', () => { + const regex1 = /\.name/; + const regex2 = /\[.name.\]/; + const string = isAda.toString(); + const result = !!string.match(regex1) || !!string.match(regex2); + expect(result).to.be.true; + }); + + it('requires the full name "Ada Lovelace"', () => { + const regex = /Ada Lovelace/; + const string = isAda.toString(); + expect(!!string.match(regex)).to.be.true; + }); + + it('doesn\'t match student.name to "Ada Lovelace"', () => { + const test = [{ + name: 'Jane' + }, { + name: 'Joe' + }, { + name: 'Ada Lovelace' + }]; + expect(test.filter(isAda)).to.deep.equal([{ + name: "Ada Lovelace" + }]); + }); + +}); diff --git a/tutorial/01/02-filter.spec.js b/tutorial/01/02.js similarity index 84% rename from tutorial/01/02-filter.spec.js rename to tutorial/01/02.js index a827036..5aeff43 100644 --- a/tutorial/01/02-filter.spec.js +++ b/tutorial/01/02.js @@ -1,21 +1,20 @@ -"use strict"; -var expect = require('chai').expect; +describe('02 var myData', () => { -describe('02 var myData', function() { + const myData = filter.__get__('myData'); - it('doesn\'t exist', function() { + it('doesn\'t exist', () => { expect(myData).to.not.be.undefined; }); - it('doesn\'t output an array', function() { + it('doesn\'t output an array', () => { expect(myData).to.be.an('array'); }); - it('doesn\'t output exactly ten items', function() { + it('doesn\'t output exactly ten items', () => { expect(myData).to.have.length(10); }); - it('isn\'t the right filtered data for "Ada Lovelace"', function() { + it('isn\'t the right filtered data for "Ada Lovelace"', () => { expect(myData).to.deep.equal([{ title: 'Relational Databases', instructor: 'Sean Quentin Lewis', diff --git a/tutorial/01/03-filter.spec.js b/tutorial/01/03.js similarity index 63% rename from tutorial/01/03-filter.spec.js rename to tutorial/01/03.js index 6d843e7..7074539 100644 --- a/tutorial/01/03-filter.spec.js +++ b/tutorial/01/03.js @@ -1,22 +1,21 @@ -"use strict"; -var expect = require('chai').expect; +describe('03 function isGoodGrade', () => { -describe('03 function isGoodGrade', function() { + const isGoodGrade = filter.__get__('isGoodGrade'); - it('doesn\'t exist', function() { + it('doesn\'t exist', () => { expect(isGoodGrade).to.not.be.undefined; }); - it('isn\'t a Function', function() { + it('isn\'t a Function', () => { expect(isGoodGrade).to.be.a('function'); }); - it('doesn\'t have any params', function() { + it('doesn\'t have any params', () => { expect(isGoodGrade.length).to.equal(1); }); - it('doesn\'t return true when an items name matches "Ada Lovelace"', function() { - var test = [{ + it('doesn\'t return true when an items name matches "Ada Lovelace"', () => { + const test = [{ grade: 'A' }, { grade: 'D' diff --git a/tutorial/01/04-filter.spec.js b/tutorial/01/04.js similarity index 79% rename from tutorial/01/04-filter.spec.js rename to tutorial/01/04.js index f3e4f35..71eb5e7 100644 --- a/tutorial/01/04-filter.spec.js +++ b/tutorial/01/04.js @@ -1,21 +1,20 @@ -"use strict"; -var expect = require('chai').expect; +describe('04 var myBest', () => { -describe('04 var myBest', function() { + const myBest = filter.__get__('myBest'); - it('doesn\'t exist', function() { + it('doesn\'t exist', () => { expect(myBest).to.not.be.undefined; }); - it('doesn\'t output an array', function() { + it('doesn\'t output an array', () => { expect(myBest).to.be.an('array'); }); - it('doesn\'t output exactly seven items', function() { + it('doesn\'t output exactly seven items', () => { expect(myBest).to.have.length(7); }); - it('isn\'t the right filtered data for "Ada Lovelace"', function() { + it('isn\'t the right filtered data for "Ada Lovelace"', () => { expect(myBest).to.deep.equal([{ title: 'Relational Databases', instructor: 'Sean Quentin Lewis', diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index cc048f3..a5daed1 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -52,7 +52,7 @@ console.log(students[0]); ``` + Write a filter condition function called `isAda` that returns true only if the name matches your name: "Ada Lovelace". -@test('01/01-filter') +@test('01/01') @action(open('01-filter.js')) @action(set( ``` @@ -70,7 +70,7 @@ function isAda(student) { @hint('Use `===` to check equality') + Set `var myData` to filter with the `isAda` function. -@test('01/02-filter') +@test('01/02') @action(insert( ``` // run the function name in filter @@ -81,7 +81,7 @@ var myData = students.filter(::>); @hint('Pass `isAda` into your `filter` call') + Write a filter condition called `isGoodGrade` that will filter out any "D" or "F" grades. -@test('01/03-filter') +@test('01/03') @action(insert( ``` @@ -98,7 +98,7 @@ function isGoodGrade(student) { + Set `var myBest` to your scores, excluding any grades that are "D" or "F". -@test('1/01/04-filter') +@test('01/04') @action(insert( ``` // filter out "D"'s and "F"'s here diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index b2f147e..8f6033e 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -10,11 +10,11 @@ Length: 1-2 hours @import('00/setup') @import('01/filter') -@import('02/sort') -@import('03/map') -@import('04/forEach') -@import('05/find') -@import('06/concat') -@import('07/reduce') -@import('08/challenge-1') -@import('09/challenge-2') + + + + + + + + From f02e4c08bc67952c609b95c81027147a7edc285f Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:26:59 -0700 Subject: [PATCH 26/46] step 2 updated --- tutorial/00/01.js | 1 - tutorial/01/01.js | 1 - tutorial/02/01-sort.spec.js | 26 ---------------------- tutorial/02/01.js | 30 ++++++++++++++++++++++++++ tutorial/02/{02-sort.spec.js => 02.js} | 0 tutorial/02/03-sort.spec.js | 5 ----- tutorial/02/03.js | 7 ++++++ tutorial/02/04-sort.spec.js | 23 -------------------- tutorial/02/04.js | 22 +++++++++++++++++++ tutorial/02/sort.md | 8 +++---- 10 files changed, 63 insertions(+), 60 deletions(-) delete mode 100644 tutorial/02/01-sort.spec.js create mode 100644 tutorial/02/01.js rename tutorial/02/{02-sort.spec.js => 02.js} (100%) delete mode 100644 tutorial/02/03-sort.spec.js create mode 100644 tutorial/02/03.js delete mode 100644 tutorial/02/04-sort.spec.js create mode 100644 tutorial/02/04.js diff --git a/tutorial/00/01.js b/tutorial/00/01.js index 2fbb00a..9ad1f22 100644 --- a/tutorial/00/01.js +++ b/tutorial/00/01.js @@ -1,4 +1,3 @@ -'use strict'; const chai = require('chai'); const spies = require('chai-spies'); const expect = chai.expect; diff --git a/tutorial/01/01.js b/tutorial/01/01.js index 35316d2..5c301cd 100644 --- a/tutorial/01/01.js +++ b/tutorial/01/01.js @@ -1,4 +1,3 @@ -'use strict'; var expect = require('chai').expect; const filter = require('BASE/01-filter.js'); diff --git a/tutorial/02/01-sort.spec.js b/tutorial/02/01-sort.spec.js deleted file mode 100644 index a961af4..0000000 --- a/tutorial/02/01-sort.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -var expect = require('chai').expect; - -// load('02/myBest.js', true) -// load('02-sort.js') - -describe('01 function compareScore', function() { - it('doesn\'t exist', function() { - expect(compareScore).to.not.be.undefined; - }); - - it('isn\'t a Function', function() { - expect(compareScore).to.be.a('function'); - }); - - it('doesn\'t have two params', function() { - expect(compareScore.length).to.equal(2); - }); - - it('doesn\'t return 1 when b\'s score is more than a\'s', function() { - expect(compareScore({ - score: 3 - }, { - score: 5 - })).to.equal(1); - }); -}); diff --git a/tutorial/02/01.js b/tutorial/02/01.js new file mode 100644 index 0000000..c994480 --- /dev/null +++ b/tutorial/02/01.js @@ -0,0 +1,30 @@ +const expect = require('chai').expect; + +// load('02/myBest.js', true) + +const sort = require('BASE/02-sort.js'); +const compareScore = sort.__get__('compareScore'); + +describe('01 function compareScore', () => { + + it('doesn\'t exist', () => { + expect(compareScore).to.not.be.undefined; + }); + + it('isn\'t a Function', () => { + expect(compareScore).to.be.a('function'); + }); + + it('doesn\'t have two params', () => { + expect(compareScore.length).to.equal(2); + }); + + it('doesn\'t return 1 when b\'s score is more than a\'s', () => { + expect(compareScore({ + score: 3 + }, { + score: 5 + })).to.equal(1); + }); + +}); diff --git a/tutorial/02/02-sort.spec.js b/tutorial/02/02.js similarity index 100% rename from tutorial/02/02-sort.spec.js rename to tutorial/02/02.js diff --git a/tutorial/02/03-sort.spec.js b/tutorial/02/03-sort.spec.js deleted file mode 100644 index e9799d5..0000000 --- a/tutorial/02/03-sort.spec.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('03 function compareScore', function() { - it('doesn\'t return 0 when b\'s score equals a\'s', function() { - expect(compareScore({score: 3}, {score: 3})).to.equal(0); - }); -}); diff --git a/tutorial/02/03.js b/tutorial/02/03.js new file mode 100644 index 0000000..76e026a --- /dev/null +++ b/tutorial/02/03.js @@ -0,0 +1,7 @@ +describe('03 function compareScore', () => { + + it('doesn\'t return 0 when b\'s score equals a\'s', () => { + expect(compareScore({score: 3}, {score: 3})).to.equal(0); + }); + +}); diff --git a/tutorial/02/04-sort.spec.js b/tutorial/02/04-sort.spec.js deleted file mode 100644 index aa5e208..0000000 --- a/tutorial/02/04-sort.spec.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; -var expect = require('chai').expect; - -describe('04 var mySorted', function() { - - it('doesn\'t exist', function() { - expect(mySorted).to.not.be.undefined; - }); - - it('doesn\'t output an array', function() { - expect(mySorted).to.be.an('array'); - }); - - it('doesn\'t output exactly seven items', function() { - expect(mySorted).to.have.length(7); - }); - - it('isn\'t the right sorted data', function() { - expect(mySorted[0].score).to.equal(93); - expect(mySorted[6].score).to.equal(73); - }); - -}); diff --git a/tutorial/02/04.js b/tutorial/02/04.js new file mode 100644 index 0000000..6f54972 --- /dev/null +++ b/tutorial/02/04.js @@ -0,0 +1,22 @@ +describe('04 var mySorted', () => { + + const mySorted = sort.__get__('mySorted'); + + it('doesn\'t exist', () => { + expect(mySorted).to.not.be.undefined; + }); + + it('doesn\'t output an array', () => { + expect(mySorted).to.be.an('array'); + }); + + it('doesn\'t output exactly seven items', () => { + expect(mySorted).to.have.length(7); + }); + + it('isn\'t the right sorted data', () => { + expect(mySorted[0].score).to.equal(93); + expect(mySorted[6].score).to.equal(73); + }); + +}); diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index b9a0153..ef9e38e 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -33,7 +33,7 @@ Alright, now time to sort your best grades to the top. First you'll need to write a sort condition function called `compareScore`. + `compareScore` should return 1 if the first score is less than the second -@test('02/01-sort') +@test('02/01') @action(open('02-sort.js')) @action(set( ``` @@ -55,15 +55,15 @@ function compareScore(a, b) { ``` )) + `compareScore` should return -1 if the first score is more than the second -@test('02/02-sort') +@test('02/02') @hint('set the second case to `b.score < a.score`') + `compareScore` should return 0 if the first score is the same as the second -@test('02/03-sort') +@test('02/03') @hint('no case is necessary, use the `default` case') + Set `mySorted` to the result of `myBest` sorted by `compareScore` -@test('02/04-sort') +@test('02/04') @action(insert( ``` // use the compare function to sort myBest From 283e02833c5b96982befd3e7cf5455a9aa94df07 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:34:57 -0700 Subject: [PATCH 27/46] re-outline step 03 --- tutorial/03/01-map.spec.js | 53 -------------------------- tutorial/03/01.js | 54 +++++++++++++++++++++++++++ tutorial/03/{02-map.spec.js => 02.js} | 13 ++++--- tutorial/03/{03-map.spec.js => 03.js} | 24 ++++++------ tutorial/03/{04-map.spec.js => 04.js} | 20 +++++----- tutorial/03/05-map.spec.js | 40 -------------------- tutorial/03/05.js | 42 +++++++++++++++++++++ tutorial/03/{06-map.spec.js => 06.js} | 6 +-- tutorial/03/map.md | 12 +++--- 9 files changed, 136 insertions(+), 128 deletions(-) delete mode 100644 tutorial/03/01-map.spec.js create mode 100644 tutorial/03/01.js rename tutorial/03/{02-map.spec.js => 02.js} (59%) rename tutorial/03/{03-map.spec.js => 03.js} (59%) rename tutorial/03/{04-map.spec.js => 04.js} (54%) delete mode 100644 tutorial/03/05-map.spec.js create mode 100644 tutorial/03/05.js rename tutorial/03/{06-map.spec.js => 06.js} (54%) diff --git a/tutorial/03/01-map.spec.js b/tutorial/03/01-map.spec.js deleted file mode 100644 index fddae04..0000000 --- a/tutorial/03/01-map.spec.js +++ /dev/null @@ -1,53 +0,0 @@ -var expect = require('chai').expect; - -// load('03/myData.js', true) -// load('03-map.js') - -describe('01 function changeGrade', function() { - - it('doesn\'t exist', function() { - expect(changeGrade).to.not.be.undefined; - }); - - it('isn\'t a function', function() { - expect(changeGrade).to.be.a('function'); - }); - - it('should take a parameter', function() { - expect(changeGrade).to.have.length(1); - }); - - it('should try changing `student.grade` first before returning `student`', function() { - var regex = /return [a-zA-Z]+\.grade/; - var func = changeGrade.toString(); - expect(func.match(regex)).to.be.null; - }); - - it('should change grades from a D to an A', function() { - var test = { - grade: 'D' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - - it('should change grades from a F to an A', function() { - var test = { - grade: 'F' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - - it('should change grades from a B to an A', function() { - var test = { - grade: 'B' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - -}); diff --git a/tutorial/03/01.js b/tutorial/03/01.js new file mode 100644 index 0000000..376ceb8 --- /dev/null +++ b/tutorial/03/01.js @@ -0,0 +1,54 @@ +const expect = require('chai').expect; +// load('03/myData.js', true) +const map = require('BASE/03-map.js'); + +describe('01 function changeGrade', () => { + + const changeGrade = map.__get__('changeGrade'); + + it('doesn\'t exist', () => { + expect(changeGrade).to.not.be.undefined; + }); + + it('isn\'t a function', () => { + expect(changeGrade).to.be.a('function'); + }); + + it('should take a parameter', () => { + expect(changeGrade).to.have.length(1); + }); + + it('should try changing `student.grade` first before returning `student`', () => { + const regex = /return [a-zA-Z]+\.grade/; + const func = changeGrade.toString(); + expect(func.match(regex)).to.be.null; + }); + + it('should change grades from a D to an A', () => { + const test = { + grade: 'D' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + + it('should change grades from a F to an A', () => { + const test = { + grade: 'F' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + + it('should change grades from a B to an A', () => { + const test = { + grade: 'B' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + +}); diff --git a/tutorial/03/02-map.spec.js b/tutorial/03/02.js similarity index 59% rename from tutorial/03/02-map.spec.js rename to tutorial/03/02.js index edf066a..6d24240 100644 --- a/tutorial/03/02-map.spec.js +++ b/tutorial/03/02.js @@ -1,22 +1,23 @@ -var expect = require('chai').expect; +describe('02 var myChanged', () => { -describe('02 var myChanged', function() { - it('doesn\'t exist', function() { + const myChanged = map.__get__('myChanged'); + + it('doesn\'t exist', () => { expect(myChanged).to.not.be.undefined; }); - it('isn\'t an array', function() { + it('isn\'t an array', () => { expect(myChanged).to.be.an('array'); }); - it('doesn\'t change all D\'s to A\'s', function () { + it('doesn\'t change all D\'s to A\'s', () => { function filterD(student) { return student.grade === 'D'; } expect(myChanged.filter(filterD)).to.have.length(0); }); - it('doesn\'t change all F\'s to A\'s', function () { + it('doesn\'t change all F\'s to A\'s', () => { function filterD(student) { return student.grade === 'F'; } diff --git a/tutorial/03/03-map.spec.js b/tutorial/03/03.js similarity index 59% rename from tutorial/03/03-map.spec.js rename to tutorial/03/03.js index 4df3ac7..6120851 100644 --- a/tutorial/03/03-map.spec.js +++ b/tutorial/03/03.js @@ -1,26 +1,26 @@ -var expect = require('chai').expect; +describe('03 function increaseScore', () => { -describe('03 function increaseScore', function() { + const increaseScore = map.__get__('increaseScore'); - it('doesn\'t exist', function() { + it('doesn\'t exist', () => { expect(increaseScore).to.not.be.undefined; }); - it('should be a function', function() { + it('should be a function', () => { expect(increaseScore).to.be.a('function'); }); - it('should take a parameter', function() { + it('should take a parameter', () => { expect(increaseScore).to.have.length(1); }); - it('should try changing the `score` first before returning the changed object', function() { + it('should try changing the `score` first before returning the changed object', () => { var regex = /return [a-zA-Z]+\.score/; var func = increaseScore.toString(); expect(func.match(regex)).to.be.null; }); - it('should increment scores by 12 points', function() { + it('should increment scores by 12 points', () => { var test = { score: 50 }; @@ -31,17 +31,19 @@ describe('03 function increaseScore', function() { }); -describe('03 var mySlightlyChanged', function() { +describe('03 var mySlightlyChanged', () => { - it('doesn\'t exist', function() { + const mySlightlyChanged = map.__get__('mySlightlyChanged'); + + it('doesn\'t exist', () => { expect(mySlightlyChanged).to.not.be.undefined; }); - it('isn\'t an array', function() { + it('isn\'t an array', () => { expect(mySlightlyChanged).to.be.an('array'); }); - it('should increment scores by 12', function() { + it('should increment scores by 12', () => { var scores = mySlightlyChanged.map(function(x) { return x.score; }); diff --git a/tutorial/03/04-map.spec.js b/tutorial/03/04.js similarity index 54% rename from tutorial/03/04-map.spec.js rename to tutorial/03/04.js index f7e095a..71724e6 100644 --- a/tutorial/03/04-map.spec.js +++ b/tutorial/03/04.js @@ -1,20 +1,20 @@ -var expect = require('chai').expect; +describe('04 function increaseScore', () => { -describe('04 function increaseScore', function() { + const increaseScore = map.__get__('increaseScore'); - it('doesn\'t exist', function() { + it('doesn\'t exist', () => { expect(increaseScore).to.not.be.undefined; }); - it('should be a function', function() { + it('should be a function', () => { expect(increaseScore).to.be.a('function'); }); - it('should take a parameter', function() { + it('should take a parameter', () => { expect(increaseScore).to.have.length(1); }); - it('shouldn\'t change scores under 95', function() { + it('shouldn\'t change scores under 95', () => { var test = { score: 82 }; @@ -23,7 +23,7 @@ describe('04 function increaseScore', function() { }); }); - it('should change scores over 95 to 95', function() { + it('should change scores over 95 to 95', () => { var test = { score: 84 }; @@ -34,9 +34,11 @@ describe('04 function increaseScore', function() { }); -describe('04 var mySlightlyChanged', function() { +describe('04 var mySlightlyChanged', () => { - it('should cap scores at 95', function() { + const mySlightlyChanged = map.__get__('mySlightlyChanged'); + + it('should cap scores at 95', () => { var scores = mySlightlyChanged.map(function(x) { return x.score; }); diff --git a/tutorial/03/05-map.spec.js b/tutorial/03/05-map.spec.js deleted file mode 100644 index 41866de..0000000 --- a/tutorial/03/05-map.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -var expect = require('chai').expect; - -describe('05 function getGrade', function() { - - it('doesn\'t exist', function() { - expect(getGrade).to.not.be.undefined; - }); - - it('should be a function', function() { - expect(getGrade).to.be.a('function'); - }); - - it('should take a parameter', function() { - expect(getGrade).to.have.length(1); - }); - - -}); - -describe('05 var myFixed', function() { - - it('doesn\'t exist', function() { - expect(myFixed).to.not.be.undefined; - }); - - it('isn\'t an array', function() { - expect(myFixed).to.be.an('array'); - }); - - it('doesn\'t have 10 items', function() { - expect(myFixed).to.have.length(10); - }); - - it('doesn\'t update grades correctly', function() { - expect(myFixed.map(function(x) { - return x.grade; - })).to.deep.equal(['A', 'A', 'C', 'A', 'B', 'C', 'A', 'A', 'A', 'C']); - }); - -}); diff --git a/tutorial/03/05.js b/tutorial/03/05.js new file mode 100644 index 0000000..0d8d9b0 --- /dev/null +++ b/tutorial/03/05.js @@ -0,0 +1,42 @@ +describe('05 function getGrade', () => { + + const getGrade = map.__get__('getGrade'); + + it('doesn\'t exist', () => { + expect(getGrade).to.not.be.undefined; + }); + + it('should be a function', () => { + expect(getGrade).to.be.a('function'); + }); + + it('should take a parameter', () => { + expect(getGrade).to.have.length(1); + }); + + +}); + +describe('05 var myFixed', () => { + + const myFixed = map.__get__('myFixed'); + + it('doesn\'t exist', () => { + expect(myFixed).to.not.be.undefined; + }); + + it('isn\'t an array', () => { + expect(myFixed).to.be.an('array'); + }); + + it('doesn\'t have 10 items', () => { + expect(myFixed).to.have.length(10); + }); + + it('doesn\'t update grades correctly', () => { + expect(myFixed.map((x) => { + return x.grade; + })).to.deep.equal(['A', 'A', 'C', 'A', 'B', 'C', 'A', 'A', 'A', 'C']); + }); + +}); diff --git a/tutorial/03/06-map.spec.js b/tutorial/03/06.js similarity index 54% rename from tutorial/03/06-map.spec.js rename to tutorial/03/06.js index a46789f..e2035d1 100644 --- a/tutorial/03/06-map.spec.js +++ b/tutorial/03/06.js @@ -1,8 +1,8 @@ -var expect = require('chai').expect; +describe('06 var scoresAndGrades', () => { -describe('06 var scoresAndGrades', function() { + const scoresAndGrades = map.__get__('scoresAndGrades'); - it('should return an array of scores and grades', function() { + it('should return an array of scores and grades', () => { expect(scoresAndGrades[0]).to.deep.equal({ grade: "A", score: 95 diff --git a/tutorial/03/map.md b/tutorial/03/map.md index cd0fa84..492fb5a 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -57,7 +57,7 @@ Those D & F grades would look a lot better if they suddenly became A's. Let's go back to before we filtered out the bad grades, and instead change the grades to A's. + Make a function `changeGrade` that takes student data and changes all grades to "A"s. -@test('03/01-map') +@test('03/01') @action(open('03-map.js')) @action(set( ``` @@ -75,7 +75,7 @@ function changeGrade(::>) { + Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result. -@test('03/02-map') +@test('03/02') @action(insert( ``` // map over `myData` with the `changeGrade` function @@ -87,7 +87,7 @@ var myChanged = myData.map(::>); + Hold up. An A in "Data Science" class looks way to suspicious. Your parents might catch on to your cheating. Let's go back to `myData` and instead increment each score by 12 points. -@test('03/03-map') +@test('03/03') @action(insert( ``` @@ -104,12 +104,12 @@ var mySlightlyChanged = myData; @hint('return `student`') + Wait. Now you're getting 105 in "Algorithm Design" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious. -@test('1/03/04-map') +@test('1/03/04') @hint('use an if clause within `increaseScore`') @hint('try `if (student.score >= 95) { student.score = 95 }`') + One more problem. Now the scores don't match the grades. you have 95 score in "3D Computer Graphics", but only a "B" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores. -@test('03/05-map') +@test('03/05') @action(insert( ``` @@ -139,7 +139,7 @@ var myFixed = mySlightlyChanged; @hint('set `student.grade = "A"` and return `student`') + Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only. -@test('03/06-map') +@test('03/06') @action(insert( ``` From d8b273897a686f2a166417725f245b3d4ae5a3e5 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:38:45 -0700 Subject: [PATCH 28/46] re-outline step 04 --- tutorial/03/04.js | 6 +++--- tutorial/04/{01-forEach.spec.js => 01.js} | 16 ++++++++-------- tutorial/04/{02-forEach.spec.js => 02.js} | 4 ++-- tutorial/04/{03-forEach.spec.js => 03.js} | 4 ++-- tutorial/04/04-forEach.spec.js | 7 ------- tutorial/04/04.js | 7 +++++++ tutorial/04/forEach.md | 8 ++++---- 7 files changed, 26 insertions(+), 26 deletions(-) rename tutorial/04/{01-forEach.spec.js => 01.js} (53%) rename tutorial/04/{02-forEach.spec.js => 02.js} (69%) rename tutorial/04/{03-forEach.spec.js => 03.js} (70%) delete mode 100644 tutorial/04/04-forEach.spec.js create mode 100644 tutorial/04/04.js diff --git a/tutorial/03/04.js b/tutorial/03/04.js index 71724e6..468444a 100644 --- a/tutorial/03/04.js +++ b/tutorial/03/04.js @@ -15,7 +15,7 @@ describe('04 function increaseScore', () => { }); it('shouldn\'t change scores under 95', () => { - var test = { + const test = { score: 82 }; expect(increaseScore(test)).to.deep.equal({ @@ -24,7 +24,7 @@ describe('04 function increaseScore', () => { }); it('should change scores over 95 to 95', () => { - var test = { + const test = { score: 84 }; expect(increaseScore(test)).to.deep.equal({ @@ -39,7 +39,7 @@ describe('04 var mySlightlyChanged', () => { const mySlightlyChanged = map.__get__('mySlightlyChanged'); it('should cap scores at 95', () => { - var scores = mySlightlyChanged.map(function(x) { + const scores = mySlightlyChanged.map(function(x) { return x.score; }); expect(Math.max.apply(Math, scores)).to.equal(95); diff --git a/tutorial/04/01-forEach.spec.js b/tutorial/04/01.js similarity index 53% rename from tutorial/04/01-forEach.spec.js rename to tutorial/04/01.js index 7329330..e4801f4 100644 --- a/tutorial/04/01-forEach.spec.js +++ b/tutorial/04/01.js @@ -1,20 +1,20 @@ -'use strict'; -var chai = require('chai'); -var spies = require('chai-spies'); -var expect = chai.expect; +const chai = require('chai'); +const spies = require('chai-spies'); +const expect = chai.expect; chai.use(spies); // load('04/myFixed.js', true) if (process.env.TASK_POSITION === '4') { myFixed = []; } -var spy = chai.spy.on(console, 'log'); -// load('04-forEach.js') +let spy = chai.spy.on(console, 'log'); -describe('01 console.log', function() { +const map = require('BASE/04-forEach.js'); + +describe('01 console.log', () => { if (process.env.TASK_POSITION !== '4') { - it('should be called 10 times', function() { + it('should be called 10 times', () => { expect(spy).to.have.been.called.with('A 95 Relational Databases'); expect(spy).to.have.been.called.with('C 77 Networks'); }); diff --git a/tutorial/04/02-forEach.spec.js b/tutorial/04/02.js similarity index 69% rename from tutorial/04/02-forEach.spec.js rename to tutorial/04/02.js index efefdc0..95794d4 100644 --- a/tutorial/04/02-forEach.spec.js +++ b/tutorial/04/02.js @@ -1,7 +1,7 @@ -describe('02 console.log', function() { +describe('02 console.log', () => { if (process.env.TASK_POSITION !== '4') { - it('should begin with an index', function() { + it('should begin with an index', () => { expect(spy).to.have.been.called.with('1 A 95 Relational Databases'); expect(spy).to.have.been.called.with('10 C 77 Networks'); }); diff --git a/tutorial/04/03-forEach.spec.js b/tutorial/04/03.js similarity index 70% rename from tutorial/04/03-forEach.spec.js rename to tutorial/04/03.js index f5753d8..5531141 100644 --- a/tutorial/04/03-forEach.spec.js +++ b/tutorial/04/03.js @@ -1,7 +1,7 @@ -describe('03 console.log', function() { +describe('03 console.log', () => { if (process.env.TASK_POSITION !== '4') { - it('should begin with an index', function() { + it('should begin with an index', () => { expect(spy).to.have.been.called.with('1/10 A 95 Relational Databases'); expect(spy).to.have.been.called.with('10/10 C 77 Networks'); }); diff --git a/tutorial/04/04-forEach.spec.js b/tutorial/04/04-forEach.spec.js deleted file mode 100644 index 7835cff..0000000 --- a/tutorial/04/04-forEach.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('04 log', function() { - - it('should pass', function () { - expect(true).to.be.true; - }); - -}); diff --git a/tutorial/04/04.js b/tutorial/04/04.js new file mode 100644 index 0000000..516c56e --- /dev/null +++ b/tutorial/04/04.js @@ -0,0 +1,7 @@ +describe('04 log', () => { + + it('should pass', () => { + expect(true).to.be.true; + }); + +}); diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index 49d5128..0fb142c 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -87,7 +87,7 @@ function addOneToLog(x) { Now that we see how `forEach` works, let's use it to make calls to the `console`. + Use `forEach` to log out your report card to the console -@test('04/01-forEach') +@test('04/01') @action(open('04-forEach.js')) @action(set( ``` @@ -104,7 +104,7 @@ myFixed.forEach(::>); @hint('call `forEach` with `logCourse`') + Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`. -@test('04/02-forEach') +@test('04/02') @action(insert( ``` @@ -121,7 +121,7 @@ myFixed.forEach(logCourseWithIndex); @hint('Add a second parameter to `logCourseWithIndex`') + Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`. -@test('04/03-forEach') +@test('04/03') @action(insert( ``` @@ -152,7 +152,7 @@ myFixed = students This is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected. -@test('04/04-forEach') +@test('04/04') @action(insert( ``` From 7379d2362c0fa55b337a50bf82b1b4916d6e321a Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:45:06 -0700 Subject: [PATCH 29/46] re-outline step 05 --- tutorial/04/01.js | 2 +- tutorial/05/01-find.spec.js | 17 ----------------- tutorial/05/01.js | 18 ++++++++++++++++++ tutorial/05/02-find.spec.js | 19 ------------------- tutorial/05/02.js | 23 +++++++++++++++++++++++ tutorial/05/03-find.spec.js | 14 -------------- tutorial/05/03.js | 16 ++++++++++++++++ tutorial/05/04-find.spec.js | 8 -------- tutorial/05/04.js | 10 ++++++++++ tutorial/05/05-find.spec.js | 7 ------- tutorial/05/05.js | 9 +++++++++ tutorial/05/find.md | 10 +++++----- 12 files changed, 82 insertions(+), 71 deletions(-) delete mode 100644 tutorial/05/01-find.spec.js create mode 100644 tutorial/05/01.js delete mode 100644 tutorial/05/02-find.spec.js create mode 100644 tutorial/05/02.js delete mode 100644 tutorial/05/03-find.spec.js create mode 100644 tutorial/05/03.js delete mode 100644 tutorial/05/04-find.spec.js create mode 100644 tutorial/05/04.js delete mode 100644 tutorial/05/05-find.spec.js create mode 100644 tutorial/05/05.js diff --git a/tutorial/04/01.js b/tutorial/04/01.js index e4801f4..4b351fb 100644 --- a/tutorial/04/01.js +++ b/tutorial/04/01.js @@ -9,7 +9,7 @@ if (process.env.TASK_POSITION === '4') { } let spy = chai.spy.on(console, 'log'); -const map = require('BASE/04-forEach.js'); +require('BASE/04-forEach.js'); describe('01 console.log', () => { diff --git a/tutorial/05/01-find.spec.js b/tutorial/05/01-find.spec.js deleted file mode 100644 index 781315b..0000000 --- a/tutorial/05/01-find.spec.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -var expect = require('chai').expect; -var spies = require('chai-spies'); - -// load('data/students2.js', true) -// loadEditor('05-find.js'); - -describe('01 var myClass', function() { - - it('should filter to "Web Security" class data', function () { - var result = global.students.filter(function (course) { - return course.title === 'Web Security'; - }); - expect(myClass).to.deep.equal(result); - }); - -}); diff --git a/tutorial/05/01.js b/tutorial/05/01.js new file mode 100644 index 0000000..c97a502 --- /dev/null +++ b/tutorial/05/01.js @@ -0,0 +1,18 @@ +const expect = require('chai').expect; + +// load('data/students2.js', true) +const find = require('BASE/05-find.js'); + +describe('01 var myClass', () => { + + const students = find.__get__('students'); + const myClass = find.__get__('myClass'); + + it('should filter to "Web Security" class data', () => { + const result = students.filter((course) => { + return course.title === 'Web Security'; + }); + expect(myClass).to.deep.equal(result); + }); + +}); diff --git a/tutorial/05/02-find.spec.js b/tutorial/05/02-find.spec.js deleted file mode 100644 index 560327b..0000000 --- a/tutorial/05/02-find.spec.js +++ /dev/null @@ -1,19 +0,0 @@ -describe('02 function notInList', function() { - - it('should filter for student.name', function() { - var regex = /[a-zA-Z]+\.name/; - var str = notInList.toString(); - expect(str.match(regex)).to.not.be.null; - }); - -}); - -describe('02 var unknownStudent', function() { - - var otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berry", "Donald Knuth", "Grace Hopper", "Hack Kerr", "James Gosling", "Ken Thompson", "Kevin Mitnick", "Linus Torvalds", "Niklaus Wirth", "Rebecca Heineman", "Tim Berners-Lee", "Xiao Tian", "Ying Cracker"]; - - it('should filter to "Web Security" class data', function() { - expect(unknownStudent.name).to.equal('he'); - }); - -}); diff --git a/tutorial/05/02.js b/tutorial/05/02.js new file mode 100644 index 0000000..5f29341 --- /dev/null +++ b/tutorial/05/02.js @@ -0,0 +1,23 @@ +describe('02 function notInList', () => { + + const notInList = find.__get__('notInList'); + + it('should filter for student.name', () => { + const regex = /[a-zA-Z]+\.name/; + const str = notInList.toString(); + expect(str.match(regex)).to.not.be.null; + }); + +}); + +describe('02 var unknownStudent', () => { + + const unknownStudent = find.__get__('unknownStudent'); + + const otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berry", "Donald Knuth", "Grace Hopper", "Hack Kerr", "James Gosling", "Ken Thompson", "Kevin Mitnick", "Linus Torvalds", "Niklaus Wirth", "Rebecca Heineman", "Tim Berners-Lee", "Xiao Tian", "Ying Cracker"]; + + it('should filter to "Web Security" class data', () => { + expect(unknownStudent.name).to.equal('he'); + }); + +}); diff --git a/tutorial/05/03-find.spec.js b/tutorial/05/03-find.spec.js deleted file mode 100644 index 0e5b60b..0000000 --- a/tutorial/05/03-find.spec.js +++ /dev/null @@ -1,14 +0,0 @@ -describe('03 var unknownStudentList', function() { - - it('should find 10 students', function() { - expect(unknownStudentList).to.have.length(10); - }); - - it('should find 10 unknown students across classes', function() { - var names = unknownStudentList.map(function(student) { - return student.name; - }).join(''); - expect(names).to.equal('!findthebestrevenge!'); - }); - -}); diff --git a/tutorial/05/03.js b/tutorial/05/03.js new file mode 100644 index 0000000..f819a31 --- /dev/null +++ b/tutorial/05/03.js @@ -0,0 +1,16 @@ +describe('03 var unknownStudentList', () => { + + const unknownStudentList = find.__get__('unknownStudentList'); + + it('should find 10 students', () => { + expect(unknownStudentList).to.have.length(10); + }); + + it('should find 10 unknown students across classes', () => { + const names = unknownStudentList.map((student) => { + return student.name; + }).join(''); + expect(names).to.equal('!findthebestrevenge!'); + }); + +}); diff --git a/tutorial/05/04-find.spec.js b/tutorial/05/04-find.spec.js deleted file mode 100644 index 1636dcc..0000000 --- a/tutorial/05/04-find.spec.js +++ /dev/null @@ -1,8 +0,0 @@ -describe('04 var unknownStudentNames', function() { - - it('should find 10 unknown students names', function() { - var names = unknownStudentNames.join(''); - expect(names).to.equal('!findthebestrevenge!'); - }); - -}); diff --git a/tutorial/05/04.js b/tutorial/05/04.js new file mode 100644 index 0000000..de916b2 --- /dev/null +++ b/tutorial/05/04.js @@ -0,0 +1,10 @@ +describe('04 var unknownStudentNames', () => { + + const unknownStudentNames = find.__get__('unknownStudentNames'); + + it('should find 10 unknown students names', () => { + const names = unknownStudentNames.join(''); + expect(names).to.equal('!findthebestrevenge!'); + }); + +}); diff --git a/tutorial/05/05-find.spec.js b/tutorial/05/05-find.spec.js deleted file mode 100644 index ac1167b..0000000 --- a/tutorial/05/05-find.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('05 var decodedName', function() { - - it('should find 10 unknown students names', function() { - expect(decodedName).to.equal('!findthebestrevenge!'); - }); - -}); diff --git a/tutorial/05/05.js b/tutorial/05/05.js new file mode 100644 index 0000000..317a40d --- /dev/null +++ b/tutorial/05/05.js @@ -0,0 +1,9 @@ +describe('05 var decodedName', () => { + + const decodedName = find.__get__('decodedName'); + + it('should find 10 unknown students names', () => { + expect(decodedName).to.equal('!findthebestrevenge!'); + }); + +}); diff --git a/tutorial/05/find.md b/tutorial/05/find.md index 459fb47..e5822b4 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -26,7 +26,7 @@ data.find(isEven); Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. + `filter` to `students` in the class titled "Web Security" -@test('05/01-find') +@test('05/01') @action(open('05-find.js')) @action(set( ``` @@ -40,7 +40,7 @@ var myClass = students.filter(::>); @hint('filter for `student.title === "Web Security"`') + `find` the name in `myClass` that isn't in the list of known students -@test('05/02-find') +@test('05/02') @action(insert( ``` @@ -65,7 +65,7 @@ var unknownStudent = myClass.find(); @hint('match for `student.name`') + `filter` down to students without known names -@test('05/03-find') +@test('05/03') @action(insert( ``` @@ -76,7 +76,7 @@ var unknownStudentList = students.filter(::>); @hint('consider reusing a function') + `map` over the result to get only the `name` property -@test('05/04-find') +@test('05/04') @action(insert( ``` @@ -87,7 +87,7 @@ var unknownStudentNames = unknownStudentList.map(::>); @hint('use `map` to return only the `student.name`') + `join('')` the array of names to output the result as a string -@test('05/05-find') +@test('05/05') @action(insert( ``` From 349a5cc5c0b99f9afea6cac94fde423c90b8c4c9 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:50:15 -0700 Subject: [PATCH 30/46] re-outline step 06 --- tutorial/06/01-concat.spec.js | 17 ----------------- tutorial/06/01.js | 17 +++++++++++++++++ tutorial/06/{02-concat.spec.js => 02.js} | 8 +++++--- tutorial/06/{03-concat.spec.js => 03.js} | 8 +++++--- tutorial/06/{04-concat.spec.js => 04.js} | 10 ++++++---- tutorial/06/{05-concat.spec.js => 05.js} | 20 ++++++++++++-------- tutorial/06/concat.md | 10 +++++----- 7 files changed, 50 insertions(+), 40 deletions(-) delete mode 100644 tutorial/06/01-concat.spec.js create mode 100644 tutorial/06/01.js rename tutorial/06/{02-concat.spec.js => 02.js} (60%) rename tutorial/06/{03-concat.spec.js => 03.js} (56%) rename tutorial/06/{04-concat.spec.js => 04.js} (66%) rename tutorial/06/{05-concat.spec.js => 05.js} (55%) diff --git a/tutorial/06/01-concat.spec.js b/tutorial/06/01-concat.spec.js deleted file mode 100644 index 19902e9..0000000 --- a/tutorial/06/01-concat.spec.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -var expect = require('chai').expect; - -// load('data/courses2.json', true) -// load('06-concat.js'); - -describe('01 var flattenedArray', function() { - - it('should flatten the array', function () { - expect(flattenedArray).to.have.length(4); - }); - - it('should flatten the array', function() { - expect(flattenedArray).to.deep.equal([1, 2, 3, 4]); - }); - -}); diff --git a/tutorial/06/01.js b/tutorial/06/01.js new file mode 100644 index 0000000..a9c248c --- /dev/null +++ b/tutorial/06/01.js @@ -0,0 +1,17 @@ +const expect = require('chai').expect; +// load('data/courses2.json', true) +const concat = require('BASE/06-concat.js'); + +describe('01 var flattenedArray', () => { + + const flattenedArray = concat.__get__('flattenedArray'); + + it('should flatten the array', () => { + expect(flattenedArray).to.have.length(4); + }); + + it('should flatten the array', () => { + expect(flattenedArray).to.deep.equal([1, 2, 3, 4]); + }); + +}); diff --git a/tutorial/06/02-concat.spec.js b/tutorial/06/02.js similarity index 60% rename from tutorial/06/02-concat.spec.js rename to tutorial/06/02.js index f2c0f1b..34eba49 100644 --- a/tutorial/06/02-concat.spec.js +++ b/tutorial/06/02.js @@ -1,11 +1,13 @@ -describe('02 var doubleArray', function() { +describe('02 var doubleArray', () => { - it('should create an array of arrays', function() { + const doubleArray = concat.__get__('doubleArray'); + + it('should create an array of arrays', () => { expect(doubleArray).to.have.length(10); expect(doubleArray[0]).to.have.length(16); }); - it('should create an array of arrays', function() { + it('should create an array of arrays', () => { expect(doubleArray[0][0]).to.deep.equal({ instructor: "Sean Quentin Lewis", title: "Relational Databases", diff --git a/tutorial/06/03-concat.spec.js b/tutorial/06/03.js similarity index 56% rename from tutorial/06/03-concat.spec.js rename to tutorial/06/03.js index 85d86ae..acfcf63 100644 --- a/tutorial/06/03-concat.spec.js +++ b/tutorial/06/03.js @@ -1,10 +1,12 @@ -describe('03 var students', function() { +describe('03 var students', () => { - it('should have 160 items', function() { + const students = concat.__get__('students'); + + it('should have 160 items', () => { expect(students).to.have.length(160); }); - it('should result in a single array of student data', function() { + it('should result in a single array of student data', () => { expect(students[0]).to.deep.equal({ instructor: "Sean Quentin Lewis", title: "Relational Databases", diff --git a/tutorial/06/04-concat.spec.js b/tutorial/06/04.js similarity index 66% rename from tutorial/06/04-concat.spec.js rename to tutorial/06/04.js index dc460e4..4eedc5f 100644 --- a/tutorial/06/04-concat.spec.js +++ b/tutorial/06/04.js @@ -1,11 +1,13 @@ -describe('04 var suspectData', function() { +describe('04 var suspectData', () => { - it('should have 10 items', function() { + const suspectData = concat.__get__('suspectData'); + + it('should have 10 items', () => { expect(suspectData).to.have.length.below(31); }); - it('should filter if the `indexOf` the suspects name is greater than -1', function() { - var hackKerrData = suspectData.filter(function(suspect) { + it('should filter if the `indexOf` the suspects name is greater than -1', () => { + const hackKerrData = suspectData.filter((suspect) => { return suspect.name === 'Hack Kerr'; }); expect(hackKerrData).to.have.length(10); diff --git a/tutorial/06/05-concat.spec.js b/tutorial/06/05.js similarity index 55% rename from tutorial/06/05-concat.spec.js rename to tutorial/06/05.js index b400176..72f0c96 100644 --- a/tutorial/06/05-concat.spec.js +++ b/tutorial/06/05.js @@ -1,27 +1,31 @@ -describe('05 var newSuspects', function() { +describe('05 var newSuspects', () => { - it('should have "Albert Gonzalez" in the list', function() { + const newSuspects = concat.__get__('newSuspects'); + + it('should have "Albert Gonzalez" in the list', () => { expect(newSuspects).to.contain('Albert Gonzalez'); }); - it('should have "Kevin Mitnick" in the list', function() { + it('should have "Kevin Mitnick" in the list', () => { expect(newSuspects).to.contain('Kevin Mitnick'); }); - it('should have only 2 names', function() { + it('should have only 2 names', () => { expect(newSuspects).to.have.length(2); }); }); -describe('05 var suspectData', function() { +describe('05 var suspectData', () => { + + const suspectData = concat.__get__('suspectData'); - it('should concat `newSuspects` onto `suspects`', function() { + it('should concat `newSuspects` onto `suspects`', () => { expect(suspectData).to.have.length(30); }); - it('should filter if the `indexOf` the suspects name is greater than -1', function() { - var kevin = suspectData.filter(function(x) { + it('should filter if the `indexOf` the suspects name is greater than -1', () => { + const kevin = suspectData.filter((x) => { return x.name === 'Kevin Mitnick'; }); expect(kevin).to.have.length(10); diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index f5e1b9a..69a0b1d 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -96,7 +96,7 @@ We have a suspect in mind: a classmate named "Hack Kerr". He's a nice guy, and h We'll test out flatten, then re-create our student array of data from the original course data. + First, test out `flatten` on the `flattenedArray` -@test('06/01-concat') +@test('06/01') @action(open('06-concat.js')) @action(set( ``` @@ -130,7 +130,7 @@ Return the fields: * name * grade * score -@test('06/02-concat') +@test('06/02') @action(insert( ``` @@ -155,7 +155,7 @@ var doubleArray = courses.map(function(course) { @hint('pair `student.name`') + Use `flatten` to put all data into a single array. Set `students` to the result. -@test('06/03-concat') +@test('06/03') @action(insert( ``` // `flatten` doubleArray @@ -165,7 +165,7 @@ var students = doubleArray::>; @hint('call `.flatten()` on `doubleArray`') + Use the `suspects` array to `filter` to only "Hack Kerr"'s data -@test('06/04-concat') +@test('06/04') @action(insert( ``` @@ -183,7 +183,7 @@ var newSuspects = ['Albert Gonzalez', 'Kevin Mitnick']; ``` `concat` the `newSuspects` onto the `suspects` list. -@test('06/05-concat') +@test('06/05') @hint('call `suspects.concat()` with `newSuspects`') @onPageComplete('In the next step, we'll look at using one of the most powerful methods: `reduce`') From 8a476c9e277b38f6759526d3136fa49eb86276de Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 15:54:46 -0700 Subject: [PATCH 31/46] re-outline step 07 --- tutorial/07/01-reduce.spec.js | 14 -------------- tutorial/07/01.js | 16 ++++++++++++++++ tutorial/07/02-reduce.spec.js | 6 ------ tutorial/07/02.js | 9 +++++++++ tutorial/07/{03-reduce.spec.js => 03.js} | 6 ++++-- tutorial/07/{04-reduce.spec.js => 04.js} | 6 ++++-- tutorial/07/05-reduce.spec.js | 6 ------ tutorial/07/05.js | 9 +++++++++ tutorial/07/06-reduce.spec.js | 6 ------ tutorial/07/06.js | 7 +++++++ tutorial/07/reduce.md | 12 ++++++------ 11 files changed, 55 insertions(+), 42 deletions(-) delete mode 100644 tutorial/07/01-reduce.spec.js create mode 100644 tutorial/07/01.js delete mode 100644 tutorial/07/02-reduce.spec.js create mode 100644 tutorial/07/02.js rename tutorial/07/{03-reduce.spec.js => 03.js} (67%) rename tutorial/07/{04-reduce.spec.js => 04.js} (81%) delete mode 100644 tutorial/07/05-reduce.spec.js create mode 100644 tutorial/07/05.js delete mode 100644 tutorial/07/06-reduce.spec.js create mode 100644 tutorial/07/06.js diff --git a/tutorial/07/01-reduce.spec.js b/tutorial/07/01-reduce.spec.js deleted file mode 100644 index 0ebe757..0000000 --- a/tutorial/07/01-reduce.spec.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -var expect = require('chai').expect; - -// load('data/courses2.json', true) -// load('07/suspectData.js') -// load('07-reduce.js') - -describe('01 var total', function() { - - it('should add the numbers up', function() { - expect(total).to.equal(54); - }); - -}); diff --git a/tutorial/07/01.js b/tutorial/07/01.js new file mode 100644 index 0000000..1e6eca0 --- /dev/null +++ b/tutorial/07/01.js @@ -0,0 +1,16 @@ +const expect = require('chai').expect; + +// load('data/courses2.json', true) +// load('07/suspectData.js') + +const reduce = require('BASE/07-reduce.js'); + +describe('01 var total', () => { + + const total = reduce.__get__('total'); + + it('should add the numbers up', () => { + expect(total).to.equal(54); + }); + +}); diff --git a/tutorial/07/02-reduce.spec.js b/tutorial/07/02-reduce.spec.js deleted file mode 100644 index a9689e8..0000000 --- a/tutorial/07/02-reduce.spec.js +++ /dev/null @@ -1,6 +0,0 @@ -describe('02 var averages', function() { - - it('should calculate the average of each class', function () { - expect(averages).to.deep.equal([57, 67, 70, 70, 71, 62, 67, 73, 62, 57]); - }); -}); diff --git a/tutorial/07/02.js b/tutorial/07/02.js new file mode 100644 index 0000000..603af38 --- /dev/null +++ b/tutorial/07/02.js @@ -0,0 +1,9 @@ +describe('02 var averages', () => { + + const averages = reduce.__get__('averages'); + + it('should calculate the average of each class', () => { + expect(averages).to.deep.equal([57, 67, 70, 70, 71, 62, 67, 73, 62, 57]); + }); + +}); diff --git a/tutorial/07/03-reduce.spec.js b/tutorial/07/03.js similarity index 67% rename from tutorial/07/03-reduce.spec.js rename to tutorial/07/03.js index ad6695c..05c38de 100644 --- a/tutorial/07/03-reduce.spec.js +++ b/tutorial/07/03.js @@ -1,6 +1,8 @@ -describe('03 var suspectScores', function() { +describe('03 var suspectScores', () => { - it('should reduce to an array of suspect scores', function() { + it('should reduce to an array of suspect scores', () => { + + const suspectScores = reduce.__get__('suspectScores'); expect(suspectScores).to.deep.equal([{ name: 'Albert Gonzalez', diff --git a/tutorial/07/04-reduce.spec.js b/tutorial/07/04.js similarity index 81% rename from tutorial/07/04-reduce.spec.js rename to tutorial/07/04.js index e3fe6a8..e155eca 100644 --- a/tutorial/07/04-reduce.spec.js +++ b/tutorial/07/04.js @@ -1,6 +1,8 @@ -describe('04 var suspectStats', function() { +describe('04 var suspectStats', () => { - it('should map over suspect data to find the score differences', function() { + it('should map over suspect data to find the score differences', () => { + + const suspectStats = reduce.__get__('suspectStats'); expect(suspectStats).to.deep.equal([{ name: 'Albert Gonzalez', diff --git a/tutorial/07/05-reduce.spec.js b/tutorial/07/05-reduce.spec.js deleted file mode 100644 index b0e2cb6..0000000 --- a/tutorial/07/05-reduce.spec.js +++ /dev/null @@ -1,6 +0,0 @@ -describe('05 var likelySuspects', function() { - - it('should reduce down to a suspect name', function () { - expect(likelySuspects).to.equal('Hack Kerr'); - }); -}); diff --git a/tutorial/07/05.js b/tutorial/07/05.js new file mode 100644 index 0000000..f10761f --- /dev/null +++ b/tutorial/07/05.js @@ -0,0 +1,9 @@ +describe('05 var likelySuspects', () => { + + const likelySuspects = reduce.__get__('likelySuspects'); + + it('should reduce down to a suspect name', () => { + expect(likelySuspects).to.equal('Hack Kerr'); + }); + +}); diff --git a/tutorial/07/06-reduce.spec.js b/tutorial/07/06-reduce.spec.js deleted file mode 100644 index e92eb94..0000000 --- a/tutorial/07/06-reduce.spec.js +++ /dev/null @@ -1,6 +0,0 @@ -describe('06 var likelySuspects', function() { - - it('should pass', function () { - expect(true).to.be.true; - }); -}); diff --git a/tutorial/07/06.js b/tutorial/07/06.js new file mode 100644 index 0000000..b24d6b4 --- /dev/null +++ b/tutorial/07/06.js @@ -0,0 +1,7 @@ +describe('06 var likelySuspects', () => { + + it('should pass', () => { + expect(true).to.be.true; + }); + +}); diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index 46e1358..3c9a8cb 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -49,7 +49,7 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp + Use `reduce` to sum the numbers in the `practice` array -@test('07/01-reduce') +@test('07/01') @action(open('07-reduce.js')) @action(set( ``` @@ -71,7 +71,7 @@ var total = practice.reduce(::>); + Not all reduce functions are so easy. `reduce` is a little more difficult to master. `map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages. -@test('07/02-reduce') +@test('07/02') @action(insert( ``` @@ -90,7 +90,7 @@ var averages = courses.map(function(course) { + `reduce` to an array of suspect scores from the `suspectData` we collected previously. -@test('07/03-reduce') +@test('07/03') @action(insert( ``` @@ -127,7 +127,7 @@ var suspectScores = suspectData.reduce(function(total, next) { difference: 15 }] ``` -@test('07/04-reduce') +@test('07/04') @action(insert( ``` @@ -151,7 +151,7 @@ var suspectStats = suspectScores.map(function(suspect) { + `reduce` down to likely suspect names by filtering with the `isCheater` function. This could be done with a `filter` & `map`, but it is simpler to just use one `reduce`. -@test('07/05-reduce') +@test('07/05') @action(insert( ``` @@ -166,7 +166,7 @@ var likelySuspects = suspectStats.reduce(function(::>) {}, []); @hint('use `.join(', ')`') + It looks like we have a likely suspect. -@test('07/06-reduce') +@test('07/06') @action(insert( ``` console.log(likelySuspects); From b9dce139c1da9be3b95d1df3cad456b447750602 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 16:49:00 -0700 Subject: [PATCH 32/46] add data loading steps as tasks --- CHANGELOG.md | 4 +- README.md | 420 +++++++++++++++++++++++++++++++- coderoad.json | 530 ++++++++++++++++++++++++++++++++++++++++- tutorial/00/01.js | 6 +- tutorial/00/setup.md | 4 +- tutorial/01/filter.md | 1 + tutorial/02/01.js | 29 +-- tutorial/02/02.js | 29 ++- tutorial/02/03.js | 6 +- tutorial/02/04.js | 21 +- tutorial/02/05.js | 22 ++ tutorial/02/sort.md | 19 +- tutorial/03/01.js | 53 +---- tutorial/03/02.js | 77 ++++-- tutorial/03/03.js | 56 ++--- tutorial/03/04.js | 35 +-- tutorial/03/05.js | 52 ++-- tutorial/03/06.js | 49 +++- tutorial/03/07.js | 15 ++ tutorial/03/map.md | 23 +- tutorial/04/01.js | 14 +- tutorial/04/02.js | 14 +- tutorial/04/03.js | 4 +- tutorial/04/04.js | 11 +- tutorial/04/05.js | 7 + tutorial/04/forEach.md | 19 +- tutorial/05/01.js | 15 +- tutorial/05/02.js | 24 +- tutorial/05/03.js | 25 +- tutorial/05/04.js | 14 +- tutorial/05/05.js | 7 +- tutorial/05/06.js | 9 + tutorial/05/find.md | 21 +- tutorial/06/01.js | 14 +- tutorial/06/02.js | 21 +- tutorial/06/03.js | 13 +- tutorial/06/04.js | 26 +- tutorial/06/05.js | 38 +-- tutorial/06/06.js | 41 ++++ tutorial/06/concat.md | 21 +- tutorial/07/01.js | 5 +- tutorial/07/03.js | 18 +- tutorial/07/04.js | 17 +- tutorial/07/05.js | 21 +- tutorial/07/06.js | 6 +- tutorial/07/07.js | 7 + tutorial/07/reduce.md | 20 +- tutorial/tutorial.md | 12 +- 48 files changed, 1483 insertions(+), 432 deletions(-) create mode 100644 tutorial/02/05.js create mode 100644 tutorial/03/07.js create mode 100644 tutorial/04/05.js create mode 100644 tutorial/05/06.js create mode 100644 tutorial/06/06.js create mode 100644 tutorial/07/07.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b0f070..4e34552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [0.6.0] - 2016-08-06 -- update for mocha-coderoad v0.10: no more loaders +- update for mocha-coderoad v0.10 +- removed loaders in favor of new syntax +- updated for es6 ## [0.5.0] - 2016-05-02 - remove "chapters" diff --git a/README.md b/README.md index 542319b..4ac44d0 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,6 @@ Keywords: javascript, functional Length: 1-2 hours - - - - - - - @@ -63,3 +56,416 @@ console.log( ); // first instructor Sean Quentin Lewis ``` + +##### Filter + +Array -> Array of items that match a condition + +You've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card. + +It would be great if you could `filter` the scores that your parents will see. + +`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below: + +``` +function isA(x) { + return x === 'a'; +} +``` + + +Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). + +``` +var list = ['a', 'b']; +list.filter(isA); + +// if isA(list[0]), add to output array +// if isA(list[1]), add to output array +// +//> ['a'] +``` + +If your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below. + +``` +function isB(x) { + return x.item === 'b' +} + +var list = [{item: 'a'}, {item: 'b'}]; +list.filter(isB); +//> [{item: 'b'}] +``` + +Where were we? Back to filtering our grades. + +There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: + +``` +console.log(students[0]); +//> { course: 'Web Security', +// instructor: 'Sue Denim', +// name: 'Rebecca Heineman', +// score: 93, +// grade: 'A' } +``` + +##### Sort + +Array -> sorted Array + +Your grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through. + +You can use the array method `sort` to arrange your data. Let's see how it works. + +```js +['c', 'b', 'a'].sort(); +//> ['a', 'b', 'c'] + +[3, 2, 1].sort(); +//> [1, 2, 3] +``` + +But what about sorting scores inside of an object? + +```js +[{a: 3}, {a: 1}, {a: 2}].sort(); +//> [{a: 3}, {a: 1}, {a: 2}] +``` + +That didn't work. Instead, you can write a custom `compareScore` function. + +A sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array: + + * -1 : sort to a lower index (front) + * 1 : sort to a higher index (back) + * 0 : stay the same + +Alright, now time to sort your best grades to the top. + +First you'll need to write a sort condition function called `compareScore`. + +##### Map + +Array -> run a function over each item -> Array + +You've filtered and sorted our data, but neither of those actually change the data. + +Wouldn't it be simpler if you could just change your grades? + +You can use the array method `map` to run a function that returns changes to your data. + +As an example, let's look at how you would increment each number in an array. + +```js +function addOne(num) { + return num + 1; +} + +[1, 2, 3].map(addOne); +//> [2, 3, 4] + +function addToVal(obj) { + obj.val += 1; + return obj; +} +[{ val: 1}].map(addToVal); +//> [{ val: 2 }] +``` + +`map` can change data, and it can also alter structure of the data you're working with. + +```js +function makeObject(num) { + return { val: num }; +} + +[1, 2].map(makeObject); +//> [{ val: 1 }, { val: 2 }] +``` + +Similarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted. + +```js +myBest + .map(function(student) { + return student.score; + }) + .sort() + .reverse() +//> [93, 91, 88, 88, 82, 81, 73] +``` + +In this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores. + +`map` is powerful. Let's see what you can do with it. + +Those D & F grades would look a lot better if they suddenly became A's. + +Let's go back to before we filtered out the bad grades, and instead change the grades to A's. + +##### forEach + +Array -> run a function for each item + +You've updated your grades, but they're still in an array. It's time to loop over them and log them to the console. + +To open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows. + +`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between: + + * **functional** & **imperative** programming + * **pure** & **impure** functions + +Know it or not, you're probably already used to "imperative" programming. + +> **Imperative** programming describes the order of actions + +Imperative code tells the computer what to do, step by step. + +```js +var x = 1; // make a variable +x = x + 1; // add one +x = x + 1; // add another +console.log(x); +//> 3 +``` + +> **Functional** programming describes the data transformation + +Functional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2. + +In the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time. + +```js +// a pure function +function addOne(x) { + return x + 1; +} +addOne(1) +//> 2 +addOne(1) +//> 2 +``` + +A function is "pure" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier. + +On the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time. + +```js +var y = 1; +// impure function +function increment(x) { + y += x; + return y; +} +increment(1) +//> 2 +increment(1) +//> 3 +``` + +It's good practice to ensure your `map` functions remain pure. + +But `forEach` can be a little more dangerous. Why? Let's have a look. + +```js +[1, 2, 3].map(addOne); +//> [2, 3, 4] + +[1, 2, 3].forEach(addOne); +//> undefined +``` + +What? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed. + +```js +// impure function, changes log +function addOneToLog(x) { + console.log(x); +} + +[1, 2, 3].forEach(addOneToLog); +//> 2 +//> 3 +//> 4 +``` + +Now that we see how `forEach` works, let's use it to make calls to the `console`. + +##### find + +Array -> first element that matches a condition + +Somehow your name has disappeared from the computer system. We'll have to `find` a way to get it back. + +You quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list. + +`find` works similar to `filter`, but returns only the first match. + +``` +var data = [1, 2, 3, 4, 5, 6]; + +function isEven(num) { + return num % 2 === 0; +} + +// returns all matching data to a condition +data.filter(isEven); +//> [2, 4, 6] + +// returns the first match +data.find(isEven); +//> [2] +``` + +Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. + +##### concat + +Array + Array -> Array + +Before we've been working on a structured set of student data. + +```js +// array of students +[ + { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Rebecca Heineman", + "score": 71, + "grade": "C" + } +// students in courses... +] +``` + +To be safe, let's now work on the original data set. Notice how it is structured differently. + +```js +// array of courses +[ + { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "students": [ + { + "name": "Rebecca Heineman", + "score": 71, + "grade": "C" + } + // students... + ] + } + // courses... +] +``` + +In this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses? + +Weird things happen when you start combining arrays. We can use `concat` to bring sanity. + +```js +[1, 2] + [3, 4]; +//> "1, 23, 4" + +[1, 2].push([3, 4]); +//> 3 + +[1, 2].join([3, 4]); +//> "13, 42" + +[1, 2].concat([3, 4]); +//> [1, 2, 3, 4] +``` + +Unfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`). + +`flatten` should loop over an array and `concat` each element. + +Let's look at an abstraction of what we need to do: + +```js +var start = [{ + a: 1, + c: [ + { b: 1 } + ] +}, { + a: 2, + c: [ + { b: 2 }, { b: 3 } + ] +}]; + +var middle = start.map(function(outer) { + return outer.c.map(function(inner) { + return { + a: outer.a, + b: inner.b + }; + }); +}); +//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ] + +var end = pre.flatten(); +//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}] +``` + +Back to business. + +We have a suspect in mind: a classmate named "Hack Kerr". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name. + +We'll test out flatten, then re-create our student array of data from the original course data. + +##### reduce + +Array -> anything + +We know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades. + +You can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations. + +`map` has a major limitation: it will always output the same number of elements as the input array. + +When you want to transform data into something different, you'll likely want to use `reduce`. + +Reduce requires two parameters: + + * the running total (set by an initialValue) + * the next value in the array + +```js +function add(total, next) { + console.log(`add(${total}, ${next}) -> ${total + next}`) + return total + next +} + +var initialValue = 100; +[1, 5, 10].reduce(add, initialValue); // initial value + +// add(100, 1) -> 101 +// add(101, 5) -> 106 +// add(106, 10) -> 116 +//> 116 +``` + +Notice in the example we input an array of 3 items and output a single number. The data has been transformed. + +It takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere. + +You may have noticed we've already used `reduce` to `flatten` our arrays. + +```js +Array.prototype.flatten = function() { + return this.reduce(function(a, b) { + return a.concat(b); + }, []); +}; +``` + +With `flatten`, the initialValue was set to an empty array which each value was `concat` onto. + +Do some practice with `reduce`, before you use it to narrow down a cheating suspect. diff --git a/coderoad.json b/coderoad.json index 87e8380..d10bcbc 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,7 +1,7 @@ { "info": { "title": "Functional School", - "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n\n\n\n\n\n\n\n" + "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n" }, "pages": [ { @@ -14,7 +14,7 @@ "00/01" ], "actions": [ - "open('students.js')", + "open('data/students.js')", "set('var students=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Brian Kernaghan\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Grace Hopper\",score:36,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"James Gosling\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ken Thompson\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Linus Torvalds\",score:34,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n')" ] }, @@ -25,7 +25,7 @@ ], "actions": [ "open('00-setup.js')", - "set('// Welcome to CodeRoad!\nimport students from './students';\n\nvar first = ::>\n')" + "set('// Welcome to CodeRoad!\nimport students from './data/students';\n\nvar first = ::>\n')" ], "hints": [ "Get the first item in students using the array index", @@ -61,6 +61,530 @@ } ], "onPageComplete": "Now we're ready to get started with `filter`ing our data." + }, + { + "title": "Filter", + "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", + "tasks": [ + { + "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", + "tests": [ + "01/01" + ], + "actions": [ + "open('01-filter.js')", + "set('import students from './data/students';\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" + ], + "hints": [ + "Some tasks have hints", + "Check if `student.name` matches \"Ada Lovelace\"", + "Use `===` to check equality" + ] + }, + { + "description": "Set `var myData` to filter with the `isAda` function.", + "tests": [ + "01/02" + ], + "actions": [ + "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" + ], + "hints": [ + "Add a function to the `filter` call: `Array.filter(function() {})`", + "Pass `isAda` into your `filter` call" + ] + }, + { + "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", + "tests": [ + "01/03" + ], + "actions": [ + "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" + ], + "hints": [ + "match for `student.grade` that isn't \"D\" or \"F\"", + "use `!==` to check non-equality", + "Match for both: `student.grade !== \"D\" && student.grade !== \"F\"`" + ] + }, + { + "description": "Set `var myBest` to your scores, excluding any grades that are \"D\" or \"F\".", + "tests": [ + "01/04" + ], + "actions": [ + "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter(::>);\n\n')" + ] + } + ], + "onPageComplete": "In the next step we'll look at how to `sort` data" + }, + { + "title": "Sort", + "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", + "tasks": [ + { + "description": "load `myBest`", + "tests": [ + "02/01" + ], + "actions": [ + "open('data/myBest.js')", + "set('const myBest=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"}];\nexport default myBest;\n')" + ] + }, + { + "description": "`compareScore` should return 1 if the first score is less than the second", + "tests": [ + "02/02" + ], + "actions": [ + "open('02-sort.js')", + "set('import myBest from './data/myBest';\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + ] + }, + { + "description": "`compareScore` should return -1 if the first score is more than the second", + "tests": [ + "02/03" + ], + "hints": [ + "set the second case to `b.score < a.score`" + ] + }, + { + "description": "`compareScore` should return 0 if the first score is the same as the second", + "tests": [ + "02/04" + ], + "hints": [ + "no case is necessary, use the `default` case" + ] + }, + { + "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", + "tests": [ + "02/05" + ], + "actions": [ + "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" + ], + "hints": [ + "try using `myBest.sort()`" + ] + } + ], + "onPageComplete": "In the next step we'll look at changing data with `map`" + }, + { + "title": "Map", + "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", + "tasks": [ + { + "description": "load \"myData\"", + "tests": [ + "03/01" + ], + "actions": [ + "open('data/myData.js')", + "set('const myData=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"}];\nexport default myData;\n')" + ] + }, + { + "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", + "tests": [ + "03/02" + ], + "actions": [ + "open('03-map.js')", + "set('import myData from './data/myData';\n// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" + ], + "hints": [ + "give `changeGrade` a parameter, call it \"student\"", + "match for `student.grade`", + "match where `student.grade === 'A'`" + ] + }, + { + "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", + "tests": [ + "03/03" + ], + "actions": [ + "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" + ] + }, + { + "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myData` and instead increment each score by 12 points.", + "tests": [ + "03/04" + ], + "actions": [ + "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" + ], + "hints": [ + "give `increaseScore` a parameter, call it \"student\"", + "it should increase `student.score`", + "return `student`" + ] + }, + { + "description": "Wait. Now you're getting 105 in \"Algorithm Design\" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious.", + "tests": [ + "1/03/05" + ], + "hints": [ + "use an if clause within `increaseScore`", + "try `if (student.score >= 95) { student.score = 95 }`" + ] + }, + { + "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores.", + "tests": [ + "03/06" + ], + "actions": [ + "insert('\n// change `getGrade` to accept an object\n// and return an object\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nvar myFixed = mySlightlyChanged;\n')" + ], + "hints": [ + "change `getGrade` to take a `student` param instead of `score`", + "change the grade and return the `student`", + "set `student.grade = \"A\"` and return `student`" + ] + }, + { + "description": "Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only.", + "tests": [ + "03/07" + ], + "actions": [ + "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" + ], + "hints": [ + "use `map` to return only the \"score\" & \"grade\" fields", + "map with a function with a parameter, call it \"student\"", + "return `{ score: student.score, grade: student.grade }`" + ] + } + ], + "onPageComplete": "In the next step we'll compare `map` with `forEach`" + }, + { + "title": "forEach", + "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nvar x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nvar y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", + "tasks": [ + { + "description": "load \"myFixed\"", + "tests": [ + "04/01" + ], + "actions": [ + "open('data/myFixed.js')", + "set('const myFixed=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:85,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:94,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:77,grade:\"C\"}];\nexport default myFixed;\n')" + ] + }, + { + "description": "Use `forEach` to log out your report card to the console", + "tests": [ + "04/02" + ], + "actions": [ + "open('04-forEach.js')", + "set('import myFixed from './data/myFixed';\n// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" + ], + "hints": [ + "call `forEach` with `logCourse`" + ] + }, + { + "description": "Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`.", + "tests": [ + "04/03" + ], + "actions": [ + "insert('\n// add a second param called 'index' to the function\nfunction logCourseWithIndex(course::>) {\n console.log(`${index + 1} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index\nmyFixed.forEach(logCourseWithIndex);\n')" + ], + "hints": [ + "Array methods can take more than one parameter", + "Add a second parameter to `logCourseWithIndex`" + ] + }, + { + "description": "Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`.", + "tests": [ + "04/04" + ], + "actions": [ + "insert('\n// add a third param called 'array' to the function\nfunction logCourseWithIndexAndArray(course, index::>) {\n console.log(`${index + 1}/${array.length} ${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console with an index and array length\nmyFixed.forEach(logCourseWithIndexAndArray);\n')" + ], + "hints": [ + "Array methods can take more than one parameter", + "Add a third parameter to `logCourseWithIndexAndArray`" + ] + }, + { + "description": "What??? Suddenly Your data has all disappeared!\n\nIt seems `myFixed` relies on a chain of methods.\n\n```js\nmyFixed = students\n .filter(isAda)\n .sort(compareScore)\n .map(increaseScore)\n .map(getGrade)\n .forEach(logCourseWithIndexAndArray)\n```\n\nThis is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected.", + "tests": [ + "04/05" + ], + "actions": [ + "insert('\nconsole.log(myFixed);\n')" + ] + } + ], + "onPageComplete": "Something strange is going on. In the next step we'll try to `find` your data." + }, + { + "title": "find", + "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nvar data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", + "tasks": [ + { + "description": "load \"students\" data", + "tests": [ + "05/01" + ], + "actions": [ + "open('data/students2.js')", + "set('const students=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"!f\",score:91,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Brian Kernaghan\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Grace Hopper\",score:36,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"James Gosling\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ken Thompson\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Linus Torvalds\",score:34,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"in\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"dt\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"he\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"be\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"st\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"re\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"ve\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"ng\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"e!\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n')" + ] + }, + { + "description": "`filter` to `students` in the class titled \"Web Security\"", + "tests": [ + "05/02" + ], + "actions": [ + "open('05-find.js')", + "set('import students from './data/students2';\n// Array.find(fn)\n\n// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" + ], + "hints": [ + "create a `filter` function", + "filter for `student.title === \"Web Security\"`" + ] + }, + { + "description": "`find` the name in `myClass` that isn't in the list of known students", + "tests": [ + "05/03" + ], + "actions": [ + "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", + "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" + ], + "hints": [ + "use `indexOf` to find what doesn't match", + "use `otherStudents.indexOf(x) === -1` to find what doesn't match", + "match for `student.name`" + ] + }, + { + "description": "`filter` down to students without known names", + "tests": [ + "05/04" + ], + "actions": [ + "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" + ], + "hints": [ + "consider reusing a function" + ] + }, + { + "description": "`map` over the result to get only the `name` property", + "tests": [ + "05/05" + ], + "actions": [ + "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" + ], + "hints": [ + "use `map` to return only the `student.name`" + ] + }, + { + "description": "`join('')` the array of names to output the result as a string", + "tests": [ + "05/06" + ], + "actions": [ + "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" + ], + "hints": [ + "call `join` following `unknownStudentNames`" + ] + } + ], + "onPageComplete": "Very strange. In the next step, let's find out who wants revenge, and give it to him!" + }, + { + "title": "concat", + "description": "Array + Array -> Array\n\nBefore we've been working on a structured set of student data.\n\n```js\n// array of students\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n// students in courses...\n]\n```\n\nTo be safe, let's now work on the original data set. Notice how it is structured differently.\n\n```js\n// array of courses\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"students\": [\n {\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n // students...\n ]\n }\n // courses...\n]\n```\n\nIn this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses?\n\nWeird things happen when you start combining arrays. We can use `concat` to bring sanity.\n\n```js\n[1, 2] + [3, 4];\n//> \"1, 23, 4\"\n\n[1, 2].push([3, 4]);\n//> 3\n\n[1, 2].join([3, 4]);\n//> \"13, 42\"\n\n[1, 2].concat([3, 4]);\n//> [1, 2, 3, 4]\n```\n\nUnfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`).\n\n`flatten` should loop over an array and `concat` each element.\n\nLet's look at an abstraction of what we need to do:\n\n```js\nvar start = [{\n a: 1,\n c: [\n { b: 1 }\n ]\n}, {\n a: 2,\n c: [\n { b: 2 }, { b: 3 }\n ]\n}];\n\nvar middle = start.map(function(outer) {\n return outer.c.map(function(inner) {\n return {\n a: outer.a,\n b: inner.b\n };\n });\n});\n//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ]\n\nvar end = pre.flatten();\n//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}]\n```\n\nBack to business.\n\nWe have a suspect in mind: a classmate named \"Hack Kerr\". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name.\n\nWe'll test out flatten, then re-create our student array of data from the original course data.", + "tasks": [ + { + "description": "load \"courses\"", + "tests": [ + "06/01" + ], + "actions": [ + "open('data/courses2.js')", + "set('const courses=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",students:[{name:\"!f\",score:61,grade:\"D\"},{name:\"Albert Gonzalez\",score:35,grade:\"F\"},{name:\"Brian Kernaghan\",score:35,grade:\"F\"},{name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{name:\"Donald Knuth\",score:94,grade:\"A\"},{name:\"Grace Hopper\",score:36,grade:\"F\"},{name:\"Hack Kerr\",score:85,grade:\"F\"},{name:\"James Gosling\",score:30,grade:\"F\"},{name:\"Ken Thompson\",score:30,grade:\"F\"},{name:\"Kevin Mitnick\",score:72,grade:\"C\"},{name:\"Linus Torvalds\",score:34,grade:\"F\"},{name:\"Niklaus Wirth\",score:75,grade:\"C\"},{name:\"Rebecca Heineman\",score:71,grade:\"C\"},{name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{name:\"Xiao Tian\",score:67,grade:\"D\"},{name:\"Ying Cracker\",score:57,grade:\"F\"}]},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",students:[{name:\"in\",score:58,grade:\"F\"},{name:\"Albert Gonzalez\",score:37,grade:\"F\"},{name:\"Brian Kernaghan\",score:76,grade:\"C\"},{name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{name:\"Donald Knuth\",score:34,grade:\"F\"},{name:\"Grace Hopper\",score:74,grade:\"C\"},{name:\"Hack Kerr\",score:86,grade:\"F\"},{name:\"James Gosling\",score:94,grade:\"A\"},{name:\"Ken Thompson\",score:48,grade:\"F\"},{name:\"Kevin Mitnick\",score:52,grade:\"F\"},{name:\"Linus Torvalds\",score:90,grade:\"A\"},{name:\"Niklaus Wirth\",score:78,grade:\"C\"},{name:\"Rebecca Heineman\",score:73,grade:\"C\"},{name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{name:\"Xiao Tian\",score:45,grade:\"F\"},{name:\"Ying Cracker\",score:77,grade:\"C\"}]},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",students:[{name:\"dt\",score:31,grade:\"F\"},{name:\"Albert Gonzalez\",score:73,grade:\"C\"},{name:\"Brian Kernaghan\",score:47,grade:\"F\"},{name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{name:\"Donald Knuth\",score:80,grade:\"B\"},{name:\"Grace Hopper\",score:80,grade:\"B\"},{name:\"Hack Kerr\",score:92,grade:\"C\"},{name:\"James Gosling\",score:97,grade:\"A\"},{name:\"Ken Thompson\",score:64,grade:\"D\"},{name:\"Kevin Mitnick\",score:47,grade:\"F\"},{name:\"Linus Torvalds\",score:58,grade:\"F\"},{name:\"Niklaus Wirth\",score:93,grade:\"A\"},{name:\"Rebecca Heineman\",score:58,grade:\"F\"},{name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{name:\"Xiao Tian\",score:36,grade:\"F\"},{name:\"Ying Cracker\",score:73,grade:\"C\"}]},{title:\"Web Security\",instructor:\"Sue Denim\",students:[{name:\"he\",score:51,grade:\"F\"},{name:\"Albert Gonzalez\",score:74,grade:\"C\"},{name:\"Brian Kernaghan\",score:92,grade:\"A\"},{name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{name:\"Donald Knuth\",score:44,grade:\"F\"},{name:\"Grace Hopper\",score:81,grade:\"B\"},{name:\"Hack Kerr\",score:75,grade:\"F\"},{name:\"James Gosling\",score:95,grade:\"A\"},{name:\"Ken Thompson\",score:84,grade:\"B\"},{name:\"Kevin Mitnick\",score:89,grade:\"B\"},{name:\"Linus Torvalds\",score:57,grade:\"F\"},{name:\"Niklaus Wirth\",score:88,grade:\"B\"},{name:\"Rebecca Heineman\",score:93,grade:\"A\"},{name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{name:\"Xiao Tian\",score:87,grade:\"B\"},{name:\"Ying Cracker\",score:42,grade:\"F\"}]},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",students:[{name:\"be\",score:43,grade:\"F\"},{name:\"Albert Gonzalez\",score:94,grade:\"A\"},{name:\"Brian Kernaghan\",score:71,grade:\"C\"},{name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{name:\"Donald Knuth\",score:94,grade:\"A\"},{name:\"Grace Hopper\",score:99,grade:\"A\"},{name:\"Hack Kerr\",score:83,grade:\"F\"},{name:\"James Gosling\",score:99,grade:\"A\"},{name:\"Ken Thompson\",score:65,grade:\"D\"},{name:\"Kevin Mitnick\",score:47,grade:\"F\"},{name:\"Linus Torvalds\",score:93,grade:\"A\"},{name:\"Niklaus Wirth\",score:50,grade:\"F\"},{name:\"Rebecca Heineman\",score:33,grade:\"F\"},{name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{name:\"Xiao Tian\",score:87,grade:\"B\"},{name:\"Ying Cracker\",score:60,grade:\"D\"}]},{title:\"Data Science\",instructor:\"Ford Fulkerson\",students:[{name:\"st\",score:28,grade:\"F\"},{name:\"Albert Gonzalez\",score:67,grade:\"D\"},{name:\"Brian Kernaghan\",score:66,grade:\"D\"},{name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{name:\"Donald Knuth\",score:36,grade:\"F\"},{name:\"Grace Hopper\",score:66,grade:\"D\"},{name:\"Hack Kerr\",score:96,grade:\"A\"},{name:\"James Gosling\",score:83,grade:\"B\"},{name:\"Ken Thompson\",score:35,grade:\"F\"},{name:\"Kevin Mitnick\",score:75,grade:\"C\"},{name:\"Linus Torvalds\",score:63,grade:\"D\"},{name:\"Niklaus Wirth\",score:75,grade:\"C\"},{name:\"Rebecca Heineman\",score:84,grade:\"B\"},{name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{name:\"Xiao Tian\",score:49,grade:\"F\"},{name:\"Ying Cracker\",score:96,grade:\"A\"}]},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",students:[{name:\"re\",score:63,grade:\"D\"},{name:\"Albert Gonzalez\",score:39,grade:\"F\"},{name:\"Brian Kernaghan\",score:69,grade:\"D\"},{name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{name:\"Donald Knuth\",score:83,grade:\"B\"},{name:\"Grace Hopper\",score:31,grade:\"F\"},{name:\"Hack Kerr\",score:94,grade:\"A\"},{name:\"James Gosling\",score:35,grade:\"F\"},{name:\"Ken Thompson\",score:67,grade:\"D\"},{name:\"Kevin Mitnick\",score:81,grade:\"B\"},{name:\"Linus Torvalds\",score:70,grade:\"C\"},{name:\"Niklaus Wirth\",score:74,grade:\"C\"},{name:\"Rebecca Heineman\",score:92,grade:\"A\"},{name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{name:\"Xiao Tian\",score:80,grade:\"B\"},{name:\"Ying Cracker\",score:84,grade:\"B\"}]},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",students:[{name:\"ve\",score:52,grade:\"F\"},{name:\"Albert Gonzalez\",score:70,grade:\"C\"},{name:\"Brian Kernaghan\",score:89,grade:\"B\"},{name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{name:\"Donald Knuth\",score:86,grade:\"B\"},{name:\"Grace Hopper\",score:42,grade:\"F\"},{name:\"Hack Kerr\",score:87,grade:\"F\"},{name:\"James Gosling\",score:89,grade:\"B\"},{name:\"Ken Thompson\",score:86,grade:\"B\"},{name:\"Kevin Mitnick\",score:41,grade:\"F\"},{name:\"Linus Torvalds\",score:76,grade:\"C\"},{name:\"Niklaus Wirth\",score:78,grade:\"C\"},{name:\"Rebecca Heineman\",score:70,grade:\"C\"},{name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{name:\"Xiao Tian\",score:93,grade:\"A\"},{name:\"Ying Cracker\",score:95,grade:\"A\"}]},{title:\"Data Structures\",instructor:\"Brodal Q.\",students:[{name:\"ng\",score:58,grade:\"F\"},{name:\"Albert Gonzalez\",score:56,grade:\"F\"},{name:\"Brian Kernaghan\",score:58,grade:\"F\"},{name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{name:\"Donald Knuth\",score:85,grade:\"B\"},{name:\"Grace Hopper\",score:53,grade:\"F\"},{name:\"Hack Kerr\",score:89,grade:\"B\"},{name:\"James Gosling\",score:42,grade:\"F\"},{name:\"Ken Thompson\",score:87,grade:\"B\"},{name:\"Kevin Mitnick\",score:40,grade:\"F\"},{name:\"Linus Torvalds\",score:91,grade:\"A\"},{name:\"Niklaus Wirth\",score:51,grade:\"F\"},{name:\"Rebecca Heineman\",score:79,grade:\"C\"},{name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{name:\"Xiao Tian\",score:84,grade:\"B\"},{name:\"Ying Cracker\",score:45,grade:\"F\"}]},{title:\"Networks\",instructor:\"Van Emde Boas\",students:[{name:\"e!\",score:35,grade:\"F\"},{name:\"Albert Gonzalez\",score:52,grade:\"F\"},{name:\"Brian Kernaghan\",score:61,grade:\"D\"},{name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{name:\"Donald Knuth\",score:89,grade:\"B\"},{name:\"Grace Hopper\",score:40,grade:\"F\"},{name:\"Hack Kerr\",score:102,grade:\"F\"},{name:\"James Gosling\",score:39,grade:\"F\"},{name:\"Ken Thompson\",score:83,grade:\"B\"},{name:\"Kevin Mitnick\",score:37,grade:\"F\"},{name:\"Linus Torvalds\",score:65,grade:\"D\"},{name:\"Niklaus Wirth\",score:36,grade:\"F\"},{name:\"Rebecca Heineman\",score:32,grade:\"F\"},{name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{name:\"Xiao Tian\",score:52,grade:\"F\"},{name:\"Ying Cracker\",score:62,grade:\"D\"}]}];\nexport default courses;\n')" + ] + }, + { + "description": "First, test out `flatten` on the `flattenedArray`", + "tests": [ + "06/02" + ], + "actions": [ + "open('06-concat.js')", + "set('import courses from './data/courses2';\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", + "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" + ], + "hints": [ + "call `.flatten()` on `numberedList`" + ] + }, + { + "description": "Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score", + "tests": [ + "06/03" + ], + "actions": [ + "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" + ], + "hints": [ + "pair `course.title`", + "pair `student.name`" + ] + }, + { + "description": "Use `flatten` to put all data into a single array. Set `students` to the result.", + "tests": [ + "06/04" + ], + "actions": [ + "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" + ], + "hints": [ + "call `.flatten()` on `doubleArray`" + ] + }, + { + "description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data", + "tests": [ + "06/05" + ], + "actions": [ + "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" + ] + }, + { + "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nvar newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", + "tests": [ + "06/06" + ], + "hints": [ + "call `suspects.concat()` with `newSuspects`" + ] + } + ], + "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" + }, + { + "title": "reduce", + "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nvar initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", + "tasks": [ + { + "description": "Use `reduce` to sum the numbers in the `practice` array", + "tests": [ + "07/01" + ], + "actions": [ + "open('07-reduce.js')", + "set('import courses from './data/courses2';\n// Array.reduce(fn(a, b), initialValue)\n\nvar practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" + ], + "hints": [ + "with only numbers, the initialValue defaults to 0", + "just call `reduce` with `add`" + ] + }, + { + "description": "Not all reduce functions are so easy. `reduce` is a little more difficult to master.\n\n`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages.", + "tests": [ + "07/02" + ], + "actions": [ + "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" + ], + "hints": [ + "set the initialValue to 0", + "like this: `reduce(function () {}, 0)`", + "return the sum of `student.score` and `total`" + ] + }, + { + "description": "load suspectData", + "tests": [ + "07/03" + ], + "actions": [ + "open('data/suspectData.js')", + "set('const suspectData=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"}];\nexport default suspectData;\n')" + ] + }, + { + "description": "`reduce` to an array of suspect scores from the `suspectData` we collected previously.", + "tests": [ + "07/04" + ], + "actions": [ + "open('07-reduce.js')", + "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" + ], + "hints": [ + "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", + "match for `next.name` & `next.score`", + "you can concat the scores onto an array: `[].concat(next.score)`", + "if the name is already in the list, just add the `next.score`" + ] + }, + { + "description": "`map` over suspect data to find the `\"difference\"` from subtracting the students score from the average score. Add this to `suspectScores` using the key `difference`. The resulting array should look like this:\n```js\n[{\n name: 'suspectName',\n scores: [50, 65, 75 ...],\n difference: 15\n}]\n```", + "tests": [ + "07/05" + ], + "actions": [ + "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" + ], + "hints": [ + "You may want to use a second param: `index`", + "Compare the `suspect.scores[index]` with the `averages[index]`", + "To get a sum, start your `reduce` function at 0" + ] + }, + { + "description": "`reduce` down to likely suspect names by filtering with the `isCheater` function.\n\nThis could be done with a `filter` & `map`, but it is simpler to just use one `reduce`.", + "tests": [ + "07/06" + ], + "actions": [ + "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" + ], + "hints": [ + "use `.join(', ')`" + ] + }, + { + "description": "It looks like we have a likely suspect.", + "tests": [ + "07/07" + ], + "actions": [ + "insert('console.log(likelySuspects);\n')" + ] + } + ] } ] } \ No newline at end of file diff --git a/tutorial/00/01.js b/tutorial/00/01.js index 9ad1f22..d9cf444 100644 --- a/tutorial/00/01.js +++ b/tutorial/00/01.js @@ -6,10 +6,10 @@ let spy = chai.spy.on(console, 'log'); describe('01 student data', () => { - const students = require('BASE/students.js'); + const students = require('BASE/data/students.js'); - it('should be loaded in "students.js"', () => { + it('should be loaded in "data/students.js"', () => { expect(students).to.be.defined; }); -}) +}); diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index 0577cd6..e5b5a02 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -27,7 +27,7 @@ console.log( + Load the student data into "students.js" @test('00/01') -@action(open('students.js')) +@action(open('data/students.js')) @action(set( ``` var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; @@ -42,7 +42,7 @@ export default students; @action(set( ``` // Welcome to CodeRoad! -import students from './students'; +import students from './data/students'; var first = ::> ``` diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index a5daed1..25ee176 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -56,6 +56,7 @@ console.log(students[0]); @action(open('01-filter.js')) @action(set( ``` +import students from './data/students'; // Array.filter(fn) function isAda(student) { diff --git a/tutorial/02/01.js b/tutorial/02/01.js index c994480..034f0f4 100644 --- a/tutorial/02/01.js +++ b/tutorial/02/01.js @@ -1,30 +1,11 @@ const expect = require('chai').expect; -// load('02/myBest.js', true) +describe('01 myBest data', () => { -const sort = require('BASE/02-sort.js'); -const compareScore = sort.__get__('compareScore'); + const myBest = require('BASE/data/myBest.js'); -describe('01 function compareScore', () => { - - it('doesn\'t exist', () => { - expect(compareScore).to.not.be.undefined; - }); - - it('isn\'t a Function', () => { - expect(compareScore).to.be.a('function'); - }); - - it('doesn\'t have two params', () => { - expect(compareScore.length).to.equal(2); - }); - - it('doesn\'t return 1 when b\'s score is more than a\'s', () => { - expect(compareScore({ - score: 3 - }, { - score: 5 - })).to.equal(1); - }); + it('should be loaded in "data/myBest.js"', () => { + expect(myBest).to.be.defined; + }); }); diff --git a/tutorial/02/02.js b/tutorial/02/02.js index c98f2b2..c638bb8 100644 --- a/tutorial/02/02.js +++ b/tutorial/02/02.js @@ -1,5 +1,26 @@ -describe('02 function compareScore', function () { - it('doesn\'t return -1 when b\'s score is less than a\'s', function() { - expect(compareScore({score: 5}, {score: 3})).to.equal(-1); - }); +const sort = require('BASE/02-sort.js'); +const compareScore = sort.__get__('compareScore'); + +describe('02 function compareScore', () => { + + it('doesn\'t exist', () => { + expect(compareScore).to.not.be.undefined; + }); + + it('isn\'t a Function', () => { + expect(compareScore).to.be.a('function'); + }); + + it('doesn\'t have two params', () => { + expect(compareScore.length).to.equal(2); + }); + + it('doesn\'t return 1 when b\'s score is more than a\'s', () => { + expect(compareScore({ + score: 3 + }, { + score: 5 + })).to.equal(1); + }); + }); diff --git a/tutorial/02/03.js b/tutorial/02/03.js index 76e026a..f3322d7 100644 --- a/tutorial/02/03.js +++ b/tutorial/02/03.js @@ -1,7 +1,7 @@ describe('03 function compareScore', () => { - it('doesn\'t return 0 when b\'s score equals a\'s', () => { - expect(compareScore({score: 3}, {score: 3})).to.equal(0); + it('doesn\'t return -1 when b\'s score is less than a\'s', () => { + expect(compareScore({score: 5}, {score: 3})).to.equal(-1); }); - + }); diff --git a/tutorial/02/04.js b/tutorial/02/04.js index 6f54972..882db54 100644 --- a/tutorial/02/04.js +++ b/tutorial/02/04.js @@ -1,22 +1,7 @@ -describe('04 var mySorted', () => { +describe('04 function compareScore', () => { - const mySorted = sort.__get__('mySorted'); - - it('doesn\'t exist', () => { - expect(mySorted).to.not.be.undefined; - }); - - it('doesn\'t output an array', () => { - expect(mySorted).to.be.an('array'); - }); - - it('doesn\'t output exactly seven items', () => { - expect(mySorted).to.have.length(7); - }); - - it('isn\'t the right sorted data', () => { - expect(mySorted[0].score).to.equal(93); - expect(mySorted[6].score).to.equal(73); + it('doesn\'t return 0 when b\'s score equals a\'s', () => { + expect(compareScore({score: 3}, {score: 3})).to.equal(0); }); }); diff --git a/tutorial/02/05.js b/tutorial/02/05.js new file mode 100644 index 0000000..9aa22b1 --- /dev/null +++ b/tutorial/02/05.js @@ -0,0 +1,22 @@ +describe('05 var mySorted', () => { + + const mySorted = sort.__get__('mySorted'); + + it('doesn\'t exist', () => { + expect(mySorted).to.not.be.undefined; + }); + + it('doesn\'t output an array', () => { + expect(mySorted).to.be.an('array'); + }); + + it('doesn\'t output exactly seven items', () => { + expect(mySorted).to.have.length(7); + }); + + it('isn\'t the right sorted data', () => { + expect(mySorted[0].score).to.equal(93); + expect(mySorted[6].score).to.equal(73); + }); + +}); diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index ef9e38e..b27ab12 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -32,11 +32,22 @@ Alright, now time to sort your best grades to the top. First you'll need to write a sort condition function called `compareScore`. -+ `compareScore` should return 1 if the first score is less than the second ++ load `myBest` @test('02/01') +@action(open('data/myBest.js')) +@action(set( +``` +const myBest=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"}]; +export default myBest; +``` +)) + ++ `compareScore` should return 1 if the first score is less than the second +@test('02/02') @action(open('02-sort.js')) @action(set( ``` +import myBest from './data/myBest'; // Array.sort(fn) function compareScore(a, b) { @@ -55,15 +66,15 @@ function compareScore(a, b) { ``` )) + `compareScore` should return -1 if the first score is more than the second -@test('02/02') +@test('02/03') @hint('set the second case to `b.score < a.score`') + `compareScore` should return 0 if the first score is the same as the second -@test('02/03') +@test('02/04') @hint('no case is necessary, use the `default` case') + Set `mySorted` to the result of `myBest` sorted by `compareScore` -@test('02/04') +@test('02/05') @action(insert( ``` // use the compare function to sort myBest diff --git a/tutorial/03/01.js b/tutorial/03/01.js index 376ceb8..08d1d76 100644 --- a/tutorial/03/01.js +++ b/tutorial/03/01.js @@ -1,54 +1,11 @@ const expect = require('chai').expect; -// load('03/myData.js', true) -const map = require('BASE/03-map.js'); -describe('01 function changeGrade', () => { +describe('01 myData data', () => { - const changeGrade = map.__get__('changeGrade'); + const myData = require('BASE/data/myData.js'); - it('doesn\'t exist', () => { - expect(changeGrade).to.not.be.undefined; - }); - - it('isn\'t a function', () => { - expect(changeGrade).to.be.a('function'); - }); - - it('should take a parameter', () => { - expect(changeGrade).to.have.length(1); - }); - - it('should try changing `student.grade` first before returning `student`', () => { - const regex = /return [a-zA-Z]+\.grade/; - const func = changeGrade.toString(); - expect(func.match(regex)).to.be.null; - }); - - it('should change grades from a D to an A', () => { - const test = { - grade: 'D' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - - it('should change grades from a F to an A', () => { - const test = { - grade: 'F' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); - - it('should change grades from a B to an A', () => { - const test = { - grade: 'B' - }; - expect(changeGrade(test)).to.deep.equal({ - grade: 'A' - }); - }); + it('should be loaded in "data/myData.js"', () => { + expect(myData).to.be.defined; + }); }); diff --git a/tutorial/03/02.js b/tutorial/03/02.js index 6d24240..05414ce 100644 --- a/tutorial/03/02.js +++ b/tutorial/03/02.js @@ -1,27 +1,54 @@ -describe('02 var myChanged', () => { - - const myChanged = map.__get__('myChanged'); - - it('doesn\'t exist', () => { - expect(myChanged).to.not.be.undefined; - }); - - it('isn\'t an array', () => { - expect(myChanged).to.be.an('array'); - }); - - it('doesn\'t change all D\'s to A\'s', () => { - function filterD(student) { - return student.grade === 'D'; - } - expect(myChanged.filter(filterD)).to.have.length(0); - }); - - it('doesn\'t change all F\'s to A\'s', () => { - function filterD(student) { - return student.grade === 'F'; - } - expect(myChanged.filter(filterD)).to.have.length(0); - }); +const expect = require('chai').expect; + +const map = require('BASE/03-map.js'); + +describe('02 function changeGrade', () => { + + const changeGrade = map.__get__('changeGrade'); + + it('doesn\'t exist', () => { + expect(changeGrade).to.not.be.undefined; + }); + + it('isn\'t a function', () => { + expect(changeGrade).to.be.a('function'); + }); + + it('should take a parameter', () => { + expect(changeGrade).to.have.length(1); + }); + + it('should try changing `student.grade` first before returning `student`', () => { + const regex = /return [a-zA-Z]+\.grade/; + const func = changeGrade.toString(); + expect(func.match(regex)).to.be.null; + }); + + it('should change grades from a D to an A', () => { + const test = { + grade: 'D' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + + it('should change grades from a F to an A', () => { + const test = { + grade: 'F' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); + + it('should change grades from a B to an A', () => { + const test = { + grade: 'B' + }; + expect(changeGrade(test)).to.deep.equal({ + grade: 'A' + }); + }); }); diff --git a/tutorial/03/03.js b/tutorial/03/03.js index 6120851..ef2331e 100644 --- a/tutorial/03/03.js +++ b/tutorial/03/03.js @@ -1,53 +1,27 @@ -describe('03 function increaseScore', () => { +describe('03 var myChanged', () => { - const increaseScore = map.__get__('increaseScore'); + const myChanged = map.__get__('myChanged'); it('doesn\'t exist', () => { - expect(increaseScore).to.not.be.undefined; + expect(myChanged).to.not.be.undefined; }); - it('should be a function', () => { - expect(increaseScore).to.be.a('function'); - }); - - it('should take a parameter', () => { - expect(increaseScore).to.have.length(1); - }); - - it('should try changing the `score` first before returning the changed object', () => { - var regex = /return [a-zA-Z]+\.score/; - var func = increaseScore.toString(); - expect(func.match(regex)).to.be.null; - }); - - it('should increment scores by 12 points', () => { - var test = { - score: 50 - }; - expect(increaseScore(test)).to.deep.equal({ - score: 62 - }); - }); - -}); - -describe('03 var mySlightlyChanged', () => { - - const mySlightlyChanged = map.__get__('mySlightlyChanged'); - - it('doesn\'t exist', () => { - expect(mySlightlyChanged).to.not.be.undefined; + it('isn\'t an array', () => { + expect(myChanged).to.be.an('array'); }); - it('isn\'t an array', () => { - expect(mySlightlyChanged).to.be.an('array'); + it('doesn\'t change all D\'s to A\'s', () => { + function filterD(student) { + return student.grade === 'D'; + } + expect(myChanged.filter(filterD)).to.have.length(0); }); - it('should increment scores by 12', () => { - var scores = mySlightlyChanged.map(function(x) { - return x.score; - }); - expect(Math.min.apply(Math, scores)).to.equal(70); + it('doesn\'t change all F\'s to A\'s', () => { + function filterD(student) { + return student.grade === 'F'; + } + expect(myChanged.filter(filterD)).to.have.length(0); }); }); diff --git a/tutorial/03/04.js b/tutorial/03/04.js index 468444a..b7c74c3 100644 --- a/tutorial/03/04.js +++ b/tutorial/03/04.js @@ -14,35 +14,40 @@ describe('04 function increaseScore', () => { expect(increaseScore).to.have.length(1); }); - it('shouldn\'t change scores under 95', () => { - const test = { - score: 82 - }; - expect(increaseScore(test)).to.deep.equal({ - score: 94 - }); + it('should try changing the `score` first before returning the changed object', () => { + var regex = /return [a-zA-Z]+\.score/; + var func = increaseScore.toString(); + expect(func.match(regex)).to.be.null; }); - it('should change scores over 95 to 95', () => { - const test = { - score: 84 + it('should increment scores by 12 points', () => { + var test = { + score: 50 }; expect(increaseScore(test)).to.deep.equal({ - score: 95 + score: 62 }); }); }); -describe('04 var mySlightlyChanged', () => { +describe('03 var mySlightlyChanged', () => { const mySlightlyChanged = map.__get__('mySlightlyChanged'); - it('should cap scores at 95', () => { - const scores = mySlightlyChanged.map(function(x) { + it('doesn\'t exist', () => { + expect(mySlightlyChanged).to.not.be.undefined; + }); + + it('isn\'t an array', () => { + expect(mySlightlyChanged).to.be.an('array'); + }); + + it('should increment scores by 12', () => { + var scores = mySlightlyChanged.map(function(x) { return x.score; }); - expect(Math.max.apply(Math, scores)).to.equal(95); + expect(Math.min.apply(Math, scores)).to.equal(70); }); }); diff --git a/tutorial/03/05.js b/tutorial/03/05.js index 0d8d9b0..b465dd1 100644 --- a/tutorial/03/05.js +++ b/tutorial/03/05.js @@ -1,42 +1,48 @@ -describe('05 function getGrade', () => { +describe('05 function increaseScore', () => { - const getGrade = map.__get__('getGrade'); + const increaseScore = map.__get__('increaseScore'); it('doesn\'t exist', () => { - expect(getGrade).to.not.be.undefined; + expect(increaseScore).to.not.be.undefined; }); it('should be a function', () => { - expect(getGrade).to.be.a('function'); + expect(increaseScore).to.be.a('function'); }); it('should take a parameter', () => { - expect(getGrade).to.have.length(1); + expect(increaseScore).to.have.length(1); }); - -}); - -describe('05 var myFixed', () => { - - const myFixed = map.__get__('myFixed'); - - it('doesn\'t exist', () => { - expect(myFixed).to.not.be.undefined; + it('shouldn\'t change scores under 95', () => { + const test = { + score: 82 + }; + expect(increaseScore(test)).to.deep.equal({ + score: 94 + }); }); - it('isn\'t an array', () => { - expect(myFixed).to.be.an('array'); + it('should change scores over 95 to 95', () => { + const test = { + score: 84 + }; + expect(increaseScore(test)).to.deep.equal({ + score: 95 + }); }); - it('doesn\'t have 10 items', () => { - expect(myFixed).to.have.length(10); - }); +}); + +describe('04 var mySlightlyChanged', () => { + + const mySlightlyChanged = map.__get__('mySlightlyChanged'); - it('doesn\'t update grades correctly', () => { - expect(myFixed.map((x) => { - return x.grade; - })).to.deep.equal(['A', 'A', 'C', 'A', 'B', 'C', 'A', 'A', 'A', 'C']); + it('should cap scores at 95', () => { + const scores = mySlightlyChanged.map(function(x) { + return x.score; + }); + expect(Math.max.apply(Math, scores)).to.equal(95); }); }); diff --git a/tutorial/03/06.js b/tutorial/03/06.js index e2035d1..d23baf9 100644 --- a/tutorial/03/06.js +++ b/tutorial/03/06.js @@ -1,15 +1,42 @@ -describe('06 var scoresAndGrades', () => { +describe('06 function getGrade', () => { - const scoresAndGrades = map.__get__('scoresAndGrades'); + const getGrade = map.__get__('getGrade'); - it('should return an array of scores and grades', () => { - expect(scoresAndGrades[0]).to.deep.equal({ - grade: "A", - score: 95 - }); - expect(scoresAndGrades[9]).to.deep.equal({ - grade: "C", - score: 77 - }); + it('doesn\'t exist', () => { + expect(getGrade).to.not.be.undefined; }); + + it('should be a function', () => { + expect(getGrade).to.be.a('function'); + }); + + it('should take a parameter', () => { + expect(getGrade).to.have.length(1); + }); + + +}); + +describe('05 var myFixed', () => { + + const myFixed = map.__get__('myFixed'); + + it('doesn\'t exist', () => { + expect(myFixed).to.not.be.undefined; + }); + + it('isn\'t an array', () => { + expect(myFixed).to.be.an('array'); + }); + + it('doesn\'t have 10 items', () => { + expect(myFixed).to.have.length(10); + }); + + it('doesn\'t update grades correctly', () => { + expect(myFixed.map((x) => { + return x.grade; + })).to.deep.equal(['A', 'A', 'C', 'A', 'B', 'C', 'A', 'A', 'A', 'C']); + }); + }); diff --git a/tutorial/03/07.js b/tutorial/03/07.js new file mode 100644 index 0000000..fb17110 --- /dev/null +++ b/tutorial/03/07.js @@ -0,0 +1,15 @@ +describe('07 var scoresAndGrades', () => { + + const scoresAndGrades = map.__get__('scoresAndGrades'); + + it('should return an array of scores and grades', () => { + expect(scoresAndGrades[0]).to.deep.equal({ + grade: "A", + score: 95 + }); + expect(scoresAndGrades[9]).to.deep.equal({ + grade: "C", + score: 77 + }); + }); +}); diff --git a/tutorial/03/map.md b/tutorial/03/map.md index 492fb5a..60423c2 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -56,11 +56,22 @@ Those D & F grades would look a lot better if they suddenly became A's. Let's go back to before we filtered out the bad grades, and instead change the grades to A's. -+ Make a function `changeGrade` that takes student data and changes all grades to "A"s. ++ load "myData" @test('03/01') +@action(open('data/myData.js')) +@action(set( +``` +const myData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"}]; +export default myData; +``` +)) + ++ Make a function `changeGrade` that takes student data and changes all grades to "A"s. +@test('03/02') @action(open('03-map.js')) @action(set( ``` +import myData from './data/myData'; // Array.map(fn) // change any `student.grade`'s into an 'A' @@ -75,7 +86,7 @@ function changeGrade(::>) { + Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result. -@test('03/02') +@test('03/03') @action(insert( ``` // map over `myData` with the `changeGrade` function @@ -87,7 +98,7 @@ var myChanged = myData.map(::>); + Hold up. An A in "Data Science" class looks way to suspicious. Your parents might catch on to your cheating. Let's go back to `myData` and instead increment each score by 12 points. -@test('03/03') +@test('03/04') @action(insert( ``` @@ -104,12 +115,12 @@ var mySlightlyChanged = myData; @hint('return `student`') + Wait. Now you're getting 105 in "Algorithm Design" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious. -@test('1/03/04') +@test('1/03/05') @hint('use an if clause within `increaseScore`') @hint('try `if (student.score >= 95) { student.score = 95 }`') + One more problem. Now the scores don't match the grades. you have 95 score in "3D Computer Graphics", but only a "B" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores. -@test('03/05') +@test('03/06') @action(insert( ``` @@ -139,7 +150,7 @@ var myFixed = mySlightlyChanged; @hint('set `student.grade = "A"` and return `student`') + Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only. -@test('03/06') +@test('03/07') @action(insert( ``` diff --git a/tutorial/04/01.js b/tutorial/04/01.js index 4b351fb..11a86b0 100644 --- a/tutorial/04/01.js +++ b/tutorial/04/01.js @@ -3,21 +3,17 @@ const spies = require('chai-spies'); const expect = chai.expect; chai.use(spies); -// load('04/myFixed.js', true) if (process.env.TASK_POSITION === '4') { myFixed = []; } let spy = chai.spy.on(console, 'log'); -require('BASE/04-forEach.js'); +describe('01 myFixed data', () => { -describe('01 console.log', () => { + const myFixed = require('BASE/data/myFixed.js'); - if (process.env.TASK_POSITION !== '4') { - it('should be called 10 times', () => { - expect(spy).to.have.been.called.with('A 95 Relational Databases'); - expect(spy).to.have.been.called.with('C 77 Networks'); - }); - } + it('should be loaded in "data/myFixed.js"', () => { + expect(myFixed).to.be.defined; + }); }); diff --git a/tutorial/04/02.js b/tutorial/04/02.js index 95794d4..698678d 100644 --- a/tutorial/04/02.js +++ b/tutorial/04/02.js @@ -1,10 +1,12 @@ +require('BASE/04-forEach.js'); + describe('02 console.log', () => { - if (process.env.TASK_POSITION !== '4') { - it('should begin with an index', () => { - expect(spy).to.have.been.called.with('1 A 95 Relational Databases'); - expect(spy).to.have.been.called.with('10 C 77 Networks'); - }); - } + if (process.env.TASK_POSITION !== '4') { + it('should be called 10 times', () => { + expect(spy).to.have.been.called.with('A 95 Relational Databases'); + expect(spy).to.have.been.called.with('C 77 Networks'); + }); + } }); diff --git a/tutorial/04/03.js b/tutorial/04/03.js index 5531141..7cee4bb 100644 --- a/tutorial/04/03.js +++ b/tutorial/04/03.js @@ -2,8 +2,8 @@ describe('03 console.log', () => { if (process.env.TASK_POSITION !== '4') { it('should begin with an index', () => { - expect(spy).to.have.been.called.with('1/10 A 95 Relational Databases'); - expect(spy).to.have.been.called.with('10/10 C 77 Networks'); + expect(spy).to.have.been.called.with('1 A 95 Relational Databases'); + expect(spy).to.have.been.called.with('10 C 77 Networks'); }); } diff --git a/tutorial/04/04.js b/tutorial/04/04.js index 516c56e..c61b2f9 100644 --- a/tutorial/04/04.js +++ b/tutorial/04/04.js @@ -1,7 +1,10 @@ -describe('04 log', () => { +describe('04 console.log', () => { - it('should pass', () => { - expect(true).to.be.true; - }); + if (process.env.TASK_POSITION !== '4') { + it('should begin with an index', () => { + expect(spy).to.have.been.called.with('1/10 A 95 Relational Databases'); + expect(spy).to.have.been.called.with('10/10 C 77 Networks'); + }); + } }); diff --git a/tutorial/04/05.js b/tutorial/04/05.js new file mode 100644 index 0000000..29710e4 --- /dev/null +++ b/tutorial/04/05.js @@ -0,0 +1,7 @@ +describe('05 log', () => { + + it('should pass', () => { + expect(true).to.be.true; + }); + +}); diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index 0fb142c..462d754 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -86,11 +86,22 @@ function addOneToLog(x) { Now that we see how `forEach` works, let's use it to make calls to the `console`. -+ Use `forEach` to log out your report card to the console ++ load "myFixed" @test('04/01') +@action(open('data/myFixed.js')) +@action(set( +``` +const myFixed=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:95,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:95,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:85,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:95,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:94,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:95,grade:"A"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:77,grade:"C"}]; +export default myFixed; +``` +)) + ++ Use `forEach` to log out your report card to the console +@test('04/02') @action(open('04-forEach.js')) @action(set( ``` +import myFixed from './data/myFixed'; // Array.forEach(fn) function logCourse(course) { @@ -104,7 +115,7 @@ myFixed.forEach(::>); @hint('call `forEach` with `logCourse`') + Add a second parameter to `logCourseWithIndex` called `index`. Then call the function with `myFixed.forEach`. -@test('04/02') +@test('04/03') @action(insert( ``` @@ -121,7 +132,7 @@ myFixed.forEach(logCourseWithIndex); @hint('Add a second parameter to `logCourseWithIndex`') + Add a third parameter called `array` to `logCourseWithIndexAndArray`, then call the function with `myFixed.forEach`. -@test('04/03') +@test('04/04') @action(insert( ``` @@ -152,7 +163,7 @@ myFixed = students This is why side-effects are dangerous. Students data must have changed, and now all of your transformations are effected. -@test('04/04') +@test('04/05') @action(insert( ``` diff --git a/tutorial/05/01.js b/tutorial/05/01.js index c97a502..171db63 100644 --- a/tutorial/05/01.js +++ b/tutorial/05/01.js @@ -1,18 +1,11 @@ const expect = require('chai').expect; -// load('data/students2.js', true) -const find = require('BASE/05-find.js'); +describe('01 students2 data', () => { -describe('01 var myClass', () => { + const students = require('BASE/data/students2.js'); - const students = find.__get__('students'); - const myClass = find.__get__('myClass'); - - it('should filter to "Web Security" class data', () => { - const result = students.filter((course) => { - return course.title === 'Web Security'; - }); - expect(myClass).to.deep.equal(result); + it('should be loaded in "data/students2.js"', () => { + expect(students).to.be.defined; }); }); diff --git a/tutorial/05/02.js b/tutorial/05/02.js index 5f29341..5eb8c04 100644 --- a/tutorial/05/02.js +++ b/tutorial/05/02.js @@ -1,23 +1,15 @@ -describe('02 function notInList', () => { +const find = require('BASE/05-find.js'); - const notInList = find.__get__('notInList'); +describe('02 var myClass', () => { - it('should filter for student.name', () => { - const regex = /[a-zA-Z]+\.name/; - const str = notInList.toString(); - expect(str.match(regex)).to.not.be.null; - }); - -}); - -describe('02 var unknownStudent', () => { - - const unknownStudent = find.__get__('unknownStudent'); - - const otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berry", "Donald Knuth", "Grace Hopper", "Hack Kerr", "James Gosling", "Ken Thompson", "Kevin Mitnick", "Linus Torvalds", "Niklaus Wirth", "Rebecca Heineman", "Tim Berners-Lee", "Xiao Tian", "Ying Cracker"]; + const students = find.__get__('students'); + const myClass = find.__get__('myClass'); it('should filter to "Web Security" class data', () => { - expect(unknownStudent.name).to.equal('he'); + const result = students.filter((course) => { + return course.title === 'Web Security'; + }); + expect(myClass).to.deep.equal(result); }); }); diff --git a/tutorial/05/03.js b/tutorial/05/03.js index f819a31..8253b9c 100644 --- a/tutorial/05/03.js +++ b/tutorial/05/03.js @@ -1,16 +1,23 @@ -describe('03 var unknownStudentList', () => { +describe('03 function notInList', () => { - const unknownStudentList = find.__get__('unknownStudentList'); + const notInList = find.__get__('notInList'); - it('should find 10 students', () => { - expect(unknownStudentList).to.have.length(10); + it('should filter for student.name', () => { + const regex = /[a-zA-Z]+\.name/; + const str = notInList.toString(); + expect(str.match(regex)).to.not.be.null; }); - it('should find 10 unknown students across classes', () => { - const names = unknownStudentList.map((student) => { - return student.name; - }).join(''); - expect(names).to.equal('!findthebestrevenge!'); +}); + +describe('03 var unknownStudent', () => { + + const unknownStudent = find.__get__('unknownStudent'); + + const otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berry", "Donald Knuth", "Grace Hopper", "Hack Kerr", "James Gosling", "Ken Thompson", "Kevin Mitnick", "Linus Torvalds", "Niklaus Wirth", "Rebecca Heineman", "Tim Berners-Lee", "Xiao Tian", "Ying Cracker"]; + + it('should filter to "Web Security" class data', () => { + expect(unknownStudent.name).to.equal('he'); }); }); diff --git a/tutorial/05/04.js b/tutorial/05/04.js index de916b2..10adf0b 100644 --- a/tutorial/05/04.js +++ b/tutorial/05/04.js @@ -1,9 +1,15 @@ -describe('04 var unknownStudentNames', () => { +describe('04 var unknownStudentList', () => { - const unknownStudentNames = find.__get__('unknownStudentNames'); + const unknownStudentList = find.__get__('unknownStudentList'); - it('should find 10 unknown students names', () => { - const names = unknownStudentNames.join(''); + it('should find 10 students', () => { + expect(unknownStudentList).to.have.length(10); + }); + + it('should find 10 unknown students across classes', () => { + const names = unknownStudentList.map((student) => { + return student.name; + }).join(''); expect(names).to.equal('!findthebestrevenge!'); }); diff --git a/tutorial/05/05.js b/tutorial/05/05.js index 317a40d..9300b10 100644 --- a/tutorial/05/05.js +++ b/tutorial/05/05.js @@ -1,9 +1,10 @@ -describe('05 var decodedName', () => { +describe('05 var unknownStudentNames', () => { - const decodedName = find.__get__('decodedName'); + const unknownStudentNames = find.__get__('unknownStudentNames'); it('should find 10 unknown students names', () => { - expect(decodedName).to.equal('!findthebestrevenge!'); + const names = unknownStudentNames.join(''); + expect(names).to.equal('!findthebestrevenge!'); }); }); diff --git a/tutorial/05/06.js b/tutorial/05/06.js new file mode 100644 index 0000000..f615675 --- /dev/null +++ b/tutorial/05/06.js @@ -0,0 +1,9 @@ +describe('06 var decodedName', () => { + + const decodedName = find.__get__('decodedName'); + + it('should find 10 unknown students names', () => { + expect(decodedName).to.equal('!findthebestrevenge!'); + }); + +}); diff --git a/tutorial/05/find.md b/tutorial/05/find.md index e5822b4..017f238 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -25,11 +25,22 @@ data.find(isEven); Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. -+ `filter` to `students` in the class titled "Web Security" ++ load "students" data @test('05/01') +@action(open('data/students2.js')) +@action(set( +``` +const students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"!f",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"in",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"dt",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"he",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"be",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"st",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"re",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"ve",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"ng",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"e!",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; +export default students; +``` +)) + ++ `filter` to `students` in the class titled "Web Security" +@test('05/02') @action(open('05-find.js')) @action(set( ``` +import students from './data/students2'; // Array.find(fn) // filter for the student title matches "Web Security" @@ -40,7 +51,7 @@ var myClass = students.filter(::>); @hint('filter for `student.title === "Web Security"`') + `find` the name in `myClass` that isn't in the list of known students -@test('05/02') +@test('05/03') @action(insert( ``` @@ -65,7 +76,7 @@ var unknownStudent = myClass.find(); @hint('match for `student.name`') + `filter` down to students without known names -@test('05/03') +@test('05/04') @action(insert( ``` @@ -76,7 +87,7 @@ var unknownStudentList = students.filter(::>); @hint('consider reusing a function') + `map` over the result to get only the `name` property -@test('05/04') +@test('05/05') @action(insert( ``` @@ -87,7 +98,7 @@ var unknownStudentNames = unknownStudentList.map(::>); @hint('use `map` to return only the `student.name`') + `join('')` the array of names to output the result as a string -@test('05/05') +@test('05/06') @action(insert( ``` diff --git a/tutorial/06/01.js b/tutorial/06/01.js index a9c248c..a9a076b 100644 --- a/tutorial/06/01.js +++ b/tutorial/06/01.js @@ -1,17 +1,11 @@ const expect = require('chai').expect; -// load('data/courses2.json', true) -const concat = require('BASE/06-concat.js'); -describe('01 var flattenedArray', () => { +describe('01 load courses', () => { - const flattenedArray = concat.__get__('flattenedArray'); + const courses = require('BASE/data/courses2.js'); - it('should flatten the array', () => { - expect(flattenedArray).to.have.length(4); - }); - - it('should flatten the array', () => { - expect(flattenedArray).to.deep.equal([1, 2, 3, 4]); + it('should be loaded in "data/courses2.js"', () => { + expect(courses).to.be.defined; }); }); diff --git a/tutorial/06/02.js b/tutorial/06/02.js index 34eba49..8d3b2f3 100644 --- a/tutorial/06/02.js +++ b/tutorial/06/02.js @@ -1,20 +1,15 @@ -describe('02 var doubleArray', () => { +const concat = require('BASE/06-concat.js'); - const doubleArray = concat.__get__('doubleArray'); +describe('02 var flattenedArray', () => { - it('should create an array of arrays', () => { - expect(doubleArray).to.have.length(10); - expect(doubleArray[0]).to.have.length(16); + const flattenedArray = concat.__get__('flattenedArray'); + + it('should flatten the array', () => { + expect(flattenedArray).to.have.length(4); }); - it('should create an array of arrays', () => { - expect(doubleArray[0][0]).to.deep.equal({ - instructor: "Sean Quentin Lewis", - title: "Relational Databases", - name: "!f", - grade: "D", - score: 61 - }); + it('should flatten the array', () => { + expect(flattenedArray).to.deep.equal([1, 2, 3, 4]); }); }); diff --git a/tutorial/06/03.js b/tutorial/06/03.js index acfcf63..d49a187 100644 --- a/tutorial/06/03.js +++ b/tutorial/06/03.js @@ -1,13 +1,14 @@ -describe('03 var students', () => { +describe('03 var doubleArray', () => { - const students = concat.__get__('students'); + const doubleArray = concat.__get__('doubleArray'); - it('should have 160 items', () => { - expect(students).to.have.length(160); + it('should create an array of arrays', () => { + expect(doubleArray).to.have.length(10); + expect(doubleArray[0]).to.have.length(16); }); - it('should result in a single array of student data', () => { - expect(students[0]).to.deep.equal({ + it('should create an array of arrays', () => { + expect(doubleArray[0][0]).to.deep.equal({ instructor: "Sean Quentin Lewis", title: "Relational Databases", name: "!f", diff --git a/tutorial/06/04.js b/tutorial/06/04.js index 4eedc5f..fc67a42 100644 --- a/tutorial/06/04.js +++ b/tutorial/06/04.js @@ -1,22 +1,18 @@ -describe('04 var suspectData', () => { +describe('04 var students', () => { - const suspectData = concat.__get__('suspectData'); + const students = concat.__get__('students'); - it('should have 10 items', () => { - expect(suspectData).to.have.length.below(31); + it('should have 160 items', () => { + expect(students).to.have.length(160); }); - it('should filter if the `indexOf` the suspects name is greater than -1', () => { - const hackKerrData = suspectData.filter((suspect) => { - return suspect.name === 'Hack Kerr'; - }); - expect(hackKerrData).to.have.length(10); - expect(hackKerrData[0]).to.deep.equal({ - title: 'Relational Databases', - instructor: 'Sean Quentin Lewis', - name: 'Hack Kerr', - score: 85, - grade: 'F' + it('should result in a single array of student data', () => { + expect(students[0]).to.deep.equal({ + instructor: "Sean Quentin Lewis", + title: "Relational Databases", + name: "!f", + grade: "D", + score: 61 }); }); diff --git a/tutorial/06/05.js b/tutorial/06/05.js index 72f0c96..d4b5a44 100644 --- a/tutorial/06/05.js +++ b/tutorial/06/05.js @@ -1,40 +1,22 @@ -describe('05 var newSuspects', () => { - - const newSuspects = concat.__get__('newSuspects'); - - it('should have "Albert Gonzalez" in the list', () => { - expect(newSuspects).to.contain('Albert Gonzalez'); - }); - - it('should have "Kevin Mitnick" in the list', () => { - expect(newSuspects).to.contain('Kevin Mitnick'); - }); - - it('should have only 2 names', () => { - expect(newSuspects).to.have.length(2); - }); - -}); - describe('05 var suspectData', () => { const suspectData = concat.__get__('suspectData'); - it('should concat `newSuspects` onto `suspects`', () => { - expect(suspectData).to.have.length(30); + it('should have 10 items', () => { + expect(suspectData).to.have.length.below(31); }); it('should filter if the `indexOf` the suspects name is greater than -1', () => { - const kevin = suspectData.filter((x) => { - return x.name === 'Kevin Mitnick'; + const hackKerrData = suspectData.filter((suspect) => { + return suspect.name === 'Hack Kerr'; }); - expect(kevin).to.have.length(10); - expect(kevin[0]).to.deep.equal({ - grade: 'C', + expect(hackKerrData).to.have.length(10); + expect(hackKerrData[0]).to.deep.equal({ + title: 'Relational Databases', instructor: 'Sean Quentin Lewis', - name: 'Kevin Mitnick', - score: 72, - title: 'Relational Databases' + name: 'Hack Kerr', + score: 85, + grade: 'F' }); }); diff --git a/tutorial/06/06.js b/tutorial/06/06.js new file mode 100644 index 0000000..7475004 --- /dev/null +++ b/tutorial/06/06.js @@ -0,0 +1,41 @@ +describe('06 var newSuspects', () => { + + const newSuspects = concat.__get__('newSuspects'); + + it('should have "Albert Gonzalez" in the list', () => { + expect(newSuspects).to.contain('Albert Gonzalez'); + }); + + it('should have "Kevin Mitnick" in the list', () => { + expect(newSuspects).to.contain('Kevin Mitnick'); + }); + + it('should have only 2 names', () => { + expect(newSuspects).to.have.length(2); + }); + +}); + +describe('05 var suspectData', () => { + + const suspectData = concat.__get__('suspectData'); + + it('should concat `newSuspects` onto `suspects`', () => { + expect(suspectData).to.have.length(30); + }); + + it('should filter if the `indexOf` the suspects name is greater than -1', () => { + const kevin = suspectData.filter((x) => { + return x.name === 'Kevin Mitnick'; + }); + expect(kevin).to.have.length(10); + expect(kevin[0]).to.deep.equal({ + grade: 'C', + instructor: 'Sean Quentin Lewis', + name: 'Kevin Mitnick', + score: 72, + title: 'Relational Databases' + }); + }); + +}); diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index 69a0b1d..2dc8c78 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -95,11 +95,22 @@ We have a suspect in mind: a classmate named "Hack Kerr". He's a nice guy, and h We'll test out flatten, then re-create our student array of data from the original course data. -+ First, test out `flatten` on the `flattenedArray` ++ load "courses" @test('06/01') +@action(open('data/courses2.js')) +@action(set( +``` +const courses=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",students:[{name:"!f",score:61,grade:"D"},{name:"Albert Gonzalez",score:35,grade:"F"},{name:"Brian Kernaghan",score:35,grade:"F"},{name:"Danielle Bunten Berry",score:78,grade:"C"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:36,grade:"F"},{name:"Hack Kerr",score:85,grade:"F"},{name:"James Gosling",score:30,grade:"F"},{name:"Ken Thompson",score:30,grade:"F"},{name:"Kevin Mitnick",score:72,grade:"C"},{name:"Linus Torvalds",score:34,grade:"F"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:71,grade:"C"},{name:"Tim Berners-Lee",score:54,grade:"F"},{name:"Xiao Tian",score:67,grade:"D"},{name:"Ying Cracker",score:57,grade:"F"}]},{title:"3D Computer Graphics",instructor:"G.L. Webb",students:[{name:"in",score:58,grade:"F"},{name:"Albert Gonzalez",score:37,grade:"F"},{name:"Brian Kernaghan",score:76,grade:"C"},{name:"Danielle Bunten Berry",score:53,grade:"F"},{name:"Donald Knuth",score:34,grade:"F"},{name:"Grace Hopper",score:74,grade:"C"},{name:"Hack Kerr",score:86,grade:"F"},{name:"James Gosling",score:94,grade:"A"},{name:"Ken Thompson",score:48,grade:"F"},{name:"Kevin Mitnick",score:52,grade:"F"},{name:"Linus Torvalds",score:90,grade:"A"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:73,grade:"C"},{name:"Tim Berners-Lee",score:94,grade:"A"},{name:"Xiao Tian",score:45,grade:"F"},{name:"Ying Cracker",score:77,grade:"C"}]},{title:"Front End Web Development",instructor:"Moe Zaick",students:[{name:"dt",score:31,grade:"F"},{name:"Albert Gonzalez",score:73,grade:"C"},{name:"Brian Kernaghan",score:47,grade:"F"},{name:"Danielle Bunten Berry",score:87,grade:"B"},{name:"Donald Knuth",score:80,grade:"B"},{name:"Grace Hopper",score:80,grade:"B"},{name:"Hack Kerr",score:92,grade:"C"},{name:"James Gosling",score:97,grade:"A"},{name:"Ken Thompson",score:64,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:58,grade:"F"},{name:"Niklaus Wirth",score:93,grade:"A"},{name:"Rebecca Heineman",score:58,grade:"F"},{name:"Tim Berners-Lee",score:98,grade:"A"},{name:"Xiao Tian",score:36,grade:"F"},{name:"Ying Cracker",score:73,grade:"C"}]},{title:"Web Security",instructor:"Sue Denim",students:[{name:"he",score:51,grade:"F"},{name:"Albert Gonzalez",score:74,grade:"C"},{name:"Brian Kernaghan",score:92,grade:"A"},{name:"Danielle Bunten Berry",score:34,grade:"F"},{name:"Donald Knuth",score:44,grade:"F"},{name:"Grace Hopper",score:81,grade:"B"},{name:"Hack Kerr",score:75,grade:"F"},{name:"James Gosling",score:95,grade:"A"},{name:"Ken Thompson",score:84,grade:"B"},{name:"Kevin Mitnick",score:89,grade:"B"},{name:"Linus Torvalds",score:57,grade:"F"},{name:"Niklaus Wirth",score:88,grade:"B"},{name:"Rebecca Heineman",score:93,grade:"A"},{name:"Tim Berners-Lee",score:36,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:42,grade:"F"}]},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",students:[{name:"be",score:43,grade:"F"},{name:"Albert Gonzalez",score:94,grade:"A"},{name:"Brian Kernaghan",score:71,grade:"C"},{name:"Danielle Bunten Berry",score:66,grade:"D"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:99,grade:"A"},{name:"Hack Kerr",score:83,grade:"F"},{name:"James Gosling",score:99,grade:"A"},{name:"Ken Thompson",score:65,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:93,grade:"A"},{name:"Niklaus Wirth",score:50,grade:"F"},{name:"Rebecca Heineman",score:33,grade:"F"},{name:"Tim Berners-Lee",score:51,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:60,grade:"D"}]},{title:"Data Science",instructor:"Ford Fulkerson",students:[{name:"st",score:28,grade:"F"},{name:"Albert Gonzalez",score:67,grade:"D"},{name:"Brian Kernaghan",score:66,grade:"D"},{name:"Danielle Bunten Berry",score:36,grade:"F"},{name:"Donald Knuth",score:36,grade:"F"},{name:"Grace Hopper",score:66,grade:"D"},{name:"Hack Kerr",score:96,grade:"A"},{name:"James Gosling",score:83,grade:"B"},{name:"Ken Thompson",score:35,grade:"F"},{name:"Kevin Mitnick",score:75,grade:"C"},{name:"Linus Torvalds",score:63,grade:"D"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:84,grade:"B"},{name:"Tim Berners-Lee",score:41,grade:"F"},{name:"Xiao Tian",score:49,grade:"F"},{name:"Ying Cracker",score:96,grade:"A"}]},{title:"Algorithm Design",instructor:"Gale Shapely",students:[{name:"re",score:63,grade:"D"},{name:"Albert Gonzalez",score:39,grade:"F"},{name:"Brian Kernaghan",score:69,grade:"D"},{name:"Danielle Bunten Berry",score:54,grade:"F"},{name:"Donald Knuth",score:83,grade:"B"},{name:"Grace Hopper",score:31,grade:"F"},{name:"Hack Kerr",score:94,grade:"A"},{name:"James Gosling",score:35,grade:"F"},{name:"Ken Thompson",score:67,grade:"D"},{name:"Kevin Mitnick",score:81,grade:"B"},{name:"Linus Torvalds",score:70,grade:"C"},{name:"Niklaus Wirth",score:74,grade:"C"},{name:"Rebecca Heineman",score:92,grade:"A"},{name:"Tim Berners-Lee",score:48,grade:"F"},{name:"Xiao Tian",score:80,grade:"B"},{name:"Ying Cracker",score:84,grade:"B"}]},{title:"Data Abstraction",instructor:"Aster Ricks",students:[{name:"ve",score:52,grade:"F"},{name:"Albert Gonzalez",score:70,grade:"C"},{name:"Brian Kernaghan",score:89,grade:"B"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:86,grade:"B"},{name:"Grace Hopper",score:42,grade:"F"},{name:"Hack Kerr",score:87,grade:"F"},{name:"James Gosling",score:89,grade:"B"},{name:"Ken Thompson",score:86,grade:"B"},{name:"Kevin Mitnick",score:41,grade:"F"},{name:"Linus Torvalds",score:76,grade:"C"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:70,grade:"C"},{name:"Tim Berners-Lee",score:74,grade:"C"},{name:"Xiao Tian",score:93,grade:"A"},{name:"Ying Cracker",score:95,grade:"A"}]},{title:"Data Structures",instructor:"Brodal Q.",students:[{name:"ng",score:58,grade:"F"},{name:"Albert Gonzalez",score:56,grade:"F"},{name:"Brian Kernaghan",score:58,grade:"F"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:85,grade:"B"},{name:"Grace Hopper",score:53,grade:"F"},{name:"Hack Kerr",score:89,grade:"B"},{name:"James Gosling",score:42,grade:"F"},{name:"Ken Thompson",score:87,grade:"B"},{name:"Kevin Mitnick",score:40,grade:"F"},{name:"Linus Torvalds",score:91,grade:"A"},{name:"Niklaus Wirth",score:51,grade:"F"},{name:"Rebecca Heineman",score:79,grade:"C"},{name:"Tim Berners-Lee",score:37,grade:"F"},{name:"Xiao Tian",score:84,grade:"B"},{name:"Ying Cracker",score:45,grade:"F"}]},{title:"Networks",instructor:"Van Emde Boas",students:[{name:"e!",score:35,grade:"F"},{name:"Albert Gonzalez",score:52,grade:"F"},{name:"Brian Kernaghan",score:61,grade:"D"},{name:"Danielle Bunten Berry",score:59,grade:"F"},{name:"Donald Knuth",score:89,grade:"B"},{name:"Grace Hopper",score:40,grade:"F"},{name:"Hack Kerr",score:102,grade:"F"},{name:"James Gosling",score:39,grade:"F"},{name:"Ken Thompson",score:83,grade:"B"},{name:"Kevin Mitnick",score:37,grade:"F"},{name:"Linus Torvalds",score:65,grade:"D"},{name:"Niklaus Wirth",score:36,grade:"F"},{name:"Rebecca Heineman",score:32,grade:"F"},{name:"Tim Berners-Lee",score:70,grade:"C"},{name:"Xiao Tian",score:52,grade:"F"},{name:"Ying Cracker",score:62,grade:"D"}]}]; +export default courses; +``` +)) + ++ First, test out `flatten` on the `flattenedArray` +@test('06/02') @action(open('06-concat.js')) @action(set( ``` +import courses from './data/courses2'; // Array.concat(any) // Array.prototype can be used to create new Array methods @@ -130,7 +141,7 @@ Return the fields: * name * grade * score -@test('06/02') +@test('06/03') @action(insert( ``` @@ -155,7 +166,7 @@ var doubleArray = courses.map(function(course) { @hint('pair `student.name`') + Use `flatten` to put all data into a single array. Set `students` to the result. -@test('06/03') +@test('06/04') @action(insert( ``` // `flatten` doubleArray @@ -165,7 +176,7 @@ var students = doubleArray::>; @hint('call `.flatten()` on `doubleArray`') + Use the `suspects` array to `filter` to only "Hack Kerr"'s data -@test('06/04') +@test('06/05') @action(insert( ``` @@ -183,7 +194,7 @@ var newSuspects = ['Albert Gonzalez', 'Kevin Mitnick']; ``` `concat` the `newSuspects` onto the `suspects` list. -@test('06/05') +@test('06/06') @hint('call `suspects.concat()` with `newSuspects`') @onPageComplete('In the next step, we'll look at using one of the most powerful methods: `reduce`') diff --git a/tutorial/07/01.js b/tutorial/07/01.js index 1e6eca0..c022f4a 100644 --- a/tutorial/07/01.js +++ b/tutorial/07/01.js @@ -1,13 +1,10 @@ const expect = require('chai').expect; -// load('data/courses2.json', true) -// load('07/suspectData.js') - const reduce = require('BASE/07-reduce.js'); describe('01 var total', () => { - const total = reduce.__get__('total'); + const total = reduce.__get__('total'); it('should add the numbers up', () => { expect(total).to.equal(54); diff --git a/tutorial/07/03.js b/tutorial/07/03.js index 05c38de..6f01c95 100644 --- a/tutorial/07/03.js +++ b/tutorial/07/03.js @@ -1,19 +1,9 @@ -describe('03 var suspectScores', () => { +describe('03 suspectData', () => { - it('should reduce to an array of suspect scores', () => { + const suspectData = require('BASE/data/suspectData.js'); - const suspectScores = reduce.__get__('suspectScores'); - - expect(suspectScores).to.deep.equal([{ - name: 'Albert Gonzalez', - scores: [35, 37, 73, 74, 94, 67, 39, 70, 56, 52] - }, { - name: 'Hack Kerr', - scores: [85, 86, 92, 75, 83, 96, 94, 87, 89, 102] - }, { - name: 'Kevin Mitnick', - scores: [72, 52, 47, 89, 47, 75, 81, 41, 40, 37] - }]); + it('should be loaded in "data/courses2.js"', () => { + expect(suspectData).to.be.defined; }); }); diff --git a/tutorial/07/04.js b/tutorial/07/04.js index e155eca..d6b3acd 100644 --- a/tutorial/07/04.js +++ b/tutorial/07/04.js @@ -1,21 +1,18 @@ -describe('04 var suspectStats', () => { +describe('04 var suspectScores', () => { - it('should map over suspect data to find the score differences', () => { + it('should reduce to an array of suspect scores', () => { - const suspectStats = reduce.__get__('suspectStats'); + const suspectScores = reduce.__get__('suspectScores'); - expect(suspectStats).to.deep.equal([{ + expect(suspectScores).to.deep.equal([{ name: 'Albert Gonzalez', - scores: [35, 37, 73, 74, 94, 67, 39, 70, 56, 52], - difference: -59 + scores: [35, 37, 73, 74, 94, 67, 39, 70, 56, 52] }, { name: 'Hack Kerr', - scores: [85, 86, 92, 75, 83, 96, 94, 87, 89, 102], - difference: 233 + scores: [85, 86, 92, 75, 83, 96, 94, 87, 89, 102] }, { name: 'Kevin Mitnick', - scores: [72, 52, 47, 89, 47, 75, 81, 41, 40, 37], - difference: -75 + scores: [72, 52, 47, 89, 47, 75, 81, 41, 40, 37] }]); }); diff --git a/tutorial/07/05.js b/tutorial/07/05.js index f10761f..9230372 100644 --- a/tutorial/07/05.js +++ b/tutorial/07/05.js @@ -1,9 +1,22 @@ -describe('05 var likelySuspects', () => { +describe('05 var suspectStats', () => { - const likelySuspects = reduce.__get__('likelySuspects'); + it('should map over suspect data to find the score differences', () => { - it('should reduce down to a suspect name', () => { - expect(likelySuspects).to.equal('Hack Kerr'); + const suspectStats = reduce.__get__('suspectStats'); + + expect(suspectStats).to.deep.equal([{ + name: 'Albert Gonzalez', + scores: [35, 37, 73, 74, 94, 67, 39, 70, 56, 52], + difference: -59 + }, { + name: 'Hack Kerr', + scores: [85, 86, 92, 75, 83, 96, 94, 87, 89, 102], + difference: 233 + }, { + name: 'Kevin Mitnick', + scores: [72, 52, 47, 89, 47, 75, 81, 41, 40, 37], + difference: -75 + }]); }); }); diff --git a/tutorial/07/06.js b/tutorial/07/06.js index b24d6b4..e5f0a5f 100644 --- a/tutorial/07/06.js +++ b/tutorial/07/06.js @@ -1,7 +1,9 @@ describe('06 var likelySuspects', () => { - it('should pass', () => { - expect(true).to.be.true; + const likelySuspects = reduce.__get__('likelySuspects'); + + it('should reduce down to a suspect name', () => { + expect(likelySuspects).to.equal('Hack Kerr'); }); }); diff --git a/tutorial/07/07.js b/tutorial/07/07.js new file mode 100644 index 0000000..1ace883 --- /dev/null +++ b/tutorial/07/07.js @@ -0,0 +1,7 @@ +describe('07 var likelySuspects', () => { + + it('should pass', () => { + expect(true).to.be.true; + }); + +}); diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index 3c9a8cb..5c67544 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -53,6 +53,7 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp @action(open('07-reduce.js')) @action(set( ``` +import courses from './data/courses2'; // Array.reduce(fn(a, b), initialValue) var practice = [1, 1, 2, 3, 5, 8, 13, 21]; @@ -88,9 +89,20 @@ var averages = courses.map(function(course) { @hint('like this: `reduce(function () {}, 0)`') @hint('return the sum of `student.score` and `total`') ++ load suspectData +@test('07/03') +@action(open('data/suspectData.js')) +@action(set( +``` +const suspectData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"}]; +export default suspectData; +``` +)) + + `reduce` to an array of suspect scores from the `suspectData` we collected previously. -@test('07/03') +@test('07/04') +@action(open('07-reduce.js')) @action(insert( ``` @@ -127,7 +139,7 @@ var suspectScores = suspectData.reduce(function(total, next) { difference: 15 }] ``` -@test('07/04') +@test('07/05') @action(insert( ``` @@ -151,7 +163,7 @@ var suspectStats = suspectScores.map(function(suspect) { + `reduce` down to likely suspect names by filtering with the `isCheater` function. This could be done with a `filter` & `map`, but it is simpler to just use one `reduce`. -@test('07/05') +@test('07/06') @action(insert( ``` @@ -166,7 +178,7 @@ var likelySuspects = suspectStats.reduce(function(::>) {}, []); @hint('use `.join(', ')`') + It looks like we have a likely suspect. -@test('07/06') +@test('07/07') @action(insert( ``` console.log(likelySuspects); diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index 8f6033e..4447c97 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -10,11 +10,11 @@ Length: 1-2 hours @import('00/setup') @import('01/filter') - - - - - - +@import('02/sort') +@import('03/map') +@import('04/forEach') +@import('05/find') +@import('06/concat') +@import('07/reduce') From ad0ea88654bac9ae55d2d30248a888255ca1d594 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 8 Aug 2016 20:59:00 -0700 Subject: [PATCH 33/46] de-minify data --- coderoad.json | 18 +- tutorial/00/data.js | 69 +++ tutorial/00/setup.md | 962 ++++++++++++++++++++++++++++++++++++- tutorial/02/myBest.js | 45 +- tutorial/02/sort.md | 44 +- tutorial/03/01.js | 8 +- tutorial/03/02.js | 2 - tutorial/03/map.md | 78 ++- tutorial/03/myCourses.js | 62 +++ tutorial/03/myData.js | 1 - tutorial/04/forEach.md | 62 ++- tutorial/04/myFixed.js | 63 ++- tutorial/05/find.md | 962 ++++++++++++++++++++++++++++++++++++- tutorial/05/students2.js | 962 +++++++++++++++++++++++++++++++++++++ tutorial/06/concat.md | 682 +++++++++++++++++++++++++- tutorial/07/reduce.md | 182 ++++++- tutorial/07/suspectData.js | 183 ++++++- 17 files changed, 4352 insertions(+), 33 deletions(-) create mode 100644 tutorial/00/data.js create mode 100644 tutorial/03/myCourses.js delete mode 100644 tutorial/03/myData.js create mode 100644 tutorial/05/students2.js diff --git a/coderoad.json b/coderoad.json index d10bcbc..41de977 100644 --- a/coderoad.json +++ b/coderoad.json @@ -15,7 +15,7 @@ ], "actions": [ "open('data/students.js')", - "set('var students=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Brian Kernaghan\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Grace Hopper\",score:36,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"James Gosling\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ken Thompson\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Linus Torvalds\",score:34,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n')" + "set('const students = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Albert Gonzalez\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Brian Kernaghan\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Danielle Bunten Berry\",\n score:78,\n grade:\"C\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Donald Knuth\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Grace Hopper\",\n score:36,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Hack Kerr\",\n score:85,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"James Gosling\",\n score:30,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ken Thompson\",\n score:30,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Kevin Mitnick\",\n score:72,\n grade:\"C\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Linus Torvalds\",\n score:34,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n\n')" ] }, { @@ -131,7 +131,7 @@ ], "actions": [ "open('data/myBest.js')", - "set('const myBest=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"}];\nexport default myBest;\n')" + "set('const myBest = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n},{\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n},{\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:81,\n grade:\"B\"\n},{\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n},{\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n},{\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:82,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n}];\nexport default myBest;\n')" ] }, { @@ -182,23 +182,23 @@ "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", "tasks": [ { - "description": "load \"myData\"", + "description": "load \"myCourses\"", "tests": [ "03/01" ], "actions": [ - "open('data/myData.js')", - "set('const myData=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:91,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"}];\nexport default myData;\n')" + "open('data/myCourses.js')", + "set('const myCourses = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n},{\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n},{\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:61,\n grade:\"D\"\n},{\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:81,\n grade:\"B\"\n},{\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:58,\n grade:\"F\"\n},{\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n},{\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:82,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n},{\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:65,\n grade:\"D\"\n}];\nexport default myCourses;\n')" ] }, { - "description": "Make a function `changeGrade` that takes student data and changes all grades to \"A\"s.", + "description": "Make a function `changeGrade` that takes a course and changes the grade to an \"A\"", "tests": [ "03/02" ], "actions": [ "open('03-map.js')", - "set('import myData from './data/myData';\n// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(::>) {\n\n}\n')" + "set('import myData from './data/myCourses';\n// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(course) {\n ::>\n}\n// example:\n// changeGrade({ grade: 'F' }) === { grade: 'A' };\n')" ], "hints": [ "give `changeGrade` a parameter, call it \"student\"", @@ -281,7 +281,7 @@ ], "actions": [ "open('data/myFixed.js')", - "set('const myFixed=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:85,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:94,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:95,grade:\"A\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:77,grade:\"C\"}];\nexport default myFixed;\n')" + "set('const myFixed = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n},{\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n},{\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:85,\n grade:\"B\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:70,\n grade:\"C\"\n},{\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:94,\n grade:\"A\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:77,\n grade:\"C\"\n}];\nexport default myFixed;\n')" ] }, { @@ -530,7 +530,7 @@ ], "actions": [ "open('data/suspectData.js')", - "set('const suspectData=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"}];\nexport default suspectData;\n')" + "set('const suspectData = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Albert Gonzalez\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Hack Kerr\",\n score:85,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Kevin Mitnick\",\n score:72,\n grade:\"C\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Albert Gonzalez\",\n score:37,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Hack Kerr\",\n score:86,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Kevin Mitnick\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Albert Gonzalez\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Hack Kerr\",\n score:92,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Albert Gonzalez\",\n score:74,\n grade:\"C\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Hack Kerr\",\n score:75,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Kevin Mitnick\",\n score:89,\n grade:\"B\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Albert Gonzalez\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Hack Kerr\",\n score:83,\n grade:\"F\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Albert Gonzalez\",\n score:67,\n grade:\"D\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Hack Kerr\",\n score:96,\n grade:\"A\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Kevin Mitnick\",\n score:75,\n grade:\"C\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Albert Gonzalez\",\n score:39,\n grade:\"F\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Hack Kerr\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Kevin Mitnick\",\n score:81,\n grade:\"B\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Albert Gonzalez\",\n score:70,\n grade:\"C\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Hack Kerr\",\n score:87,\n grade:\"F\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Kevin Mitnick\",\n score:41,\n grade:\"F\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Albert Gonzalez\",\n score:56,\n grade:\"F\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Hack Kerr\",\n score:89,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Kevin Mitnick\",\n score:40,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Albert Gonzalez\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Hack Kerr\",\n score:102,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Kevin Mitnick\",\n score:37,\n grade:\"F\"\n}];\nexport default suspectData;\n')" ] }, { diff --git a/tutorial/00/data.js b/tutorial/00/data.js new file mode 100644 index 0000000..e51976d --- /dev/null +++ b/tutorial/00/data.js @@ -0,0 +1,69 @@ +const students = [{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ada Lovelace", + score:91, + grade:"A" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Albert Gonzalez", + score:35, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Brian Kernaghan", + score:35, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Danielle Bunten Berry", + score:78, + grade:"C" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Donald Knuth", + score:94, + grade:"A" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Grace Hopper", + score:36, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Hack Kerr", + score:85, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"James Gosling", + score:30, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ken Thompson", + score:30, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Kevin Mitnick", + score:72, + grade:"C" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Linus Torvalds", + score:34, + grade:"F" +}, { + title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; +export default students; diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index e5b5a02..31572d3 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -30,7 +30,967 @@ console.log( @action(open('data/students.js')) @action(set( ``` -var students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; +const students = [{ + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ada Lovelace", + score: 91, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Albert Gonzalez", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Brian Kernaghan", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Danielle Bunten Berry", + score: 78, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Grace Hopper", + score: 36, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Hack Kerr", + score: 85, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "James Gosling", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ken Thompson", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Kevin Mitnick", + score: 72, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Linus Torvalds", + score: 34, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Rebecca Heineman", + score: 71, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Tim Berners-Lee", + score: 54, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Xiao Tian", + score: 67, + grade: "D" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ying Cracker", + score: 57, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ada Lovelace", + score: 88, + grade: "B" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Albert Gonzalez", + score: 37, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Brian Kernaghan", + score: 76, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Danielle Bunten Berry", + score: 53, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Donald Knuth", + score: 34, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Grace Hopper", + score: 74, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Hack Kerr", + score: 86, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "James Gosling", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ken Thompson", + score: 48, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Kevin Mitnick", + score: 52, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Linus Torvalds", + score: 90, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Rebecca Heineman", + score: 73, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Tim Berners-Lee", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Xiao Tian", + score: 45, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ying Cracker", + score: 77, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ada Lovelace", + score: 61, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Albert Gonzalez", + score: 73, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Brian Kernaghan", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Danielle Bunten Berry", + score: 87, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Donald Knuth", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Grace Hopper", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Hack Kerr", + score: 92, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "James Gosling", + score: 97, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ken Thompson", + score: 64, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Linus Torvalds", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Niklaus Wirth", + score: 93, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Rebecca Heineman", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Tim Berners-Lee", + score: 98, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Xiao Tian", + score: 36, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ying Cracker", + score: 73, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ada Lovelace", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Albert Gonzalez", + score: 74, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Brian Kernaghan", + score: 92, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Danielle Bunten Berry", + score: 34, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Donald Knuth", + score: 44, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Grace Hopper", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Hack Kerr", + score: 75, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "James Gosling", + score: 95, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ken Thompson", + score: 84, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Kevin Mitnick", + score: 89, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Linus Torvalds", + score: 57, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Niklaus Wirth", + score: 88, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Rebecca Heineman", + score: 93, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Tim Berners-Lee", + score: 36, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ying Cracker", + score: 42, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ada Lovelace", + score: 73, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Albert Gonzalez", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Brian Kernaghan", + score: 71, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Danielle Bunten Berry", + score: 66, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Grace Hopper", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Hack Kerr", + score: 83, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "James Gosling", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ken Thompson", + score: 65, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Linus Torvalds", + score: 93, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Niklaus Wirth", + score: 50, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Rebecca Heineman", + score: 33, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Tim Berners-Lee", + score: 51, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ying Cracker", + score: 60, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ada Lovelace", + score: 58, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Albert Gonzalez", + score: 67, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Brian Kernaghan", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Danielle Bunten Berry", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Donald Knuth", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Grace Hopper", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Hack Kerr", + score: 96, + grade: "A" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "James Gosling", + score: 83, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ken Thompson", + score: 35, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Kevin Mitnick", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Linus Torvalds", + score: 63, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Rebecca Heineman", + score: 84, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Tim Berners-Lee", + score: 41, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Xiao Tian", + score: 49, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ying Cracker", + score: 96, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ada Lovelace", + score: 93, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Albert Gonzalez", + score: 39, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Brian Kernaghan", + score: 69, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Danielle Bunten Berry", + score: 54, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Donald Knuth", + score: 83, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Grace Hopper", + score: 31, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Hack Kerr", + score: 94, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "James Gosling", + score: 35, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ken Thompson", + score: 67, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Kevin Mitnick", + score: 81, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Linus Torvalds", + score: 70, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Niklaus Wirth", + score: 74, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Rebecca Heineman", + score: 92, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Tim Berners-Lee", + score: 48, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Xiao Tian", + score: 80, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ying Cracker", + score: 84, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ada Lovelace", + score: 82, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Albert Gonzalez", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Brian Kernaghan", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Donald Knuth", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Grace Hopper", + score: 42, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Hack Kerr", + score: 87, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "James Gosling", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ken Thompson", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Kevin Mitnick", + score: 41, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Linus Torvalds", + score: 76, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Rebecca Heineman", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Tim Berners-Lee", + score: 74, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Xiao Tian", + score: 93, + grade: "A" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ying Cracker", + score: 95, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ada Lovelace", + score: 88, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Albert Gonzalez", + score: 56, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Brian Kernaghan", + score: 58, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Donald Knuth", + score: 85, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Grace Hopper", + score: 53, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Hack Kerr", + score: 89, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "James Gosling", + score: 42, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ken Thompson", + score: 87, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Kevin Mitnick", + score: 40, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Linus Torvalds", + score: 91, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Niklaus Wirth", + score: 51, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Rebecca Heineman", + score: 79, + grade: "C" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Tim Berners-Lee", + score: 37, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Xiao Tian", + score: 84, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ying Cracker", + score: 45, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ada Lovelace", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Albert Gonzalez", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Brian Kernaghan", + score: 61, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Danielle Bunten Berry", + score: 59, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Donald Knuth", + score: 89, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Grace Hopper", + score: 40, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Hack Kerr", + score: 102, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "James Gosling", + score: 39, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ken Thompson", + score: 83, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Kevin Mitnick", + score: 37, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Linus Torvalds", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Niklaus Wirth", + score: 36, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Rebecca Heineman", + score: 32, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Tim Berners-Lee", + score: 70, + grade: "C" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Xiao Tian", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ying Cracker", + score: 62, + grade: "D" +}]; export default students; ``` )) diff --git a/tutorial/02/myBest.js b/tutorial/02/myBest.js index d44a06b..c2148a3 100644 --- a/tutorial/02/myBest.js +++ b/tutorial/02/myBest.js @@ -1 +1,44 @@ -var myBest=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"}]; +const myBest=[{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ada Lovelace", + score:91, + grade:"A" +},{ + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Ada Lovelace", + score:88, + grade:"B" +},{ + title:"Web Security", + instructor:"Sue Denim", + name:"Ada Lovelace", + score:81, + grade:"B" +},{ + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Ada Lovelace", + score:73, + grade:"C" +},{ + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Ada Lovelace", + score:93, + grade:"A" +},{ + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Ada Lovelace", + score:82, + grade:"B" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Ada Lovelace", + score:88, + grade:"B" +}]; +export default myBest; diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index b27ab12..103c912 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -37,7 +37,49 @@ First you'll need to write a sort condition function called `compareScore`. @action(open('data/myBest.js')) @action(set( ``` -const myBest=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"}]; +const myBest = [{ + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ada Lovelace", + score: 91, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ada Lovelace", + score: 88, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ada Lovelace", + score: 81, + grade: "B" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ada Lovelace", + score: 73, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ada Lovelace", + score: 93, + grade: "A" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ada Lovelace", + score: 82, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ada Lovelace", + score: 88, + grade: "B" +}]; export default myBest; ``` )) diff --git a/tutorial/03/01.js b/tutorial/03/01.js index 08d1d76..19494f6 100644 --- a/tutorial/03/01.js +++ b/tutorial/03/01.js @@ -1,11 +1,11 @@ const expect = require('chai').expect; -describe('01 myData data', () => { +describe('01 myCourses data', () => { - const myData = require('BASE/data/myData.js'); + const myCourses = require('BASE/data/myCourses.js'); - it('should be loaded in "data/myData.js"', () => { - expect(myData).to.be.defined; + it('should be loaded in "data/myCourses.js"', () => { + expect(myCourses).to.be.defined; }); }); diff --git a/tutorial/03/02.js b/tutorial/03/02.js index 05414ce..ff20cc9 100644 --- a/tutorial/03/02.js +++ b/tutorial/03/02.js @@ -1,5 +1,3 @@ -const expect = require('chai').expect; - const map = require('BASE/03-map.js'); describe('02 function changeGrade', () => { diff --git a/tutorial/03/map.md b/tutorial/03/map.md index 60423c2..ebf820e 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -56,28 +56,90 @@ Those D & F grades would look a lot better if they suddenly became A's. Let's go back to before we filtered out the bad grades, and instead change the grades to A's. -+ load "myData" ++ load "myCourses" @test('03/01') -@action(open('data/myData.js')) +@action(open('data/myCourses.js')) @action(set( ``` -const myData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"}]; -export default myData; +const myCourses = [{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ada Lovelace", + score:91, + grade:"A" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Ada Lovelace", + score:88, + grade:"B" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Ada Lovelace", + score:61, + grade:"D" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Ada Lovelace", + score:81, + grade:"B" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Ada Lovelace", + score:73, + grade:"C" +}, { + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Ada Lovelace", + score:58, + grade:"F" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Ada Lovelace", + score:93, + grade:"A" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Ada Lovelace", + score:82, + grade:"B" +}, { + title:"Data Structures", + instructor:"Brodal Q.", + name:"Ada Lovelace", + score:88, + grade:"B" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Ada Lovelace", + score:65, + grade:"D" +}]; +export default myCourses; ``` )) -+ Make a function `changeGrade` that takes student data and changes all grades to "A"s. ++ Make a function `changeGrade` that takes a course and changes the grade to an "A" @test('03/02') @action(open('03-map.js')) @action(set( ``` -import myData from './data/myData'; +import myData from './data/myCourses'; // Array.map(fn) // change any `student.grade`'s into an 'A' -function changeGrade(::>) { - +function changeGrade(course) { + ::> } +// example: +// changeGrade({ grade: 'F' }) === { grade: 'A' }; ``` )) @hint('give `changeGrade` a parameter, call it "student"') diff --git a/tutorial/03/myCourses.js b/tutorial/03/myCourses.js new file mode 100644 index 0000000..be136db --- /dev/null +++ b/tutorial/03/myCourses.js @@ -0,0 +1,62 @@ +const myCourses=[{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ada Lovelace", + score:91, + grade:"A" +},{ + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Ada Lovelace", + score:88, + grade:"B" +},{ + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Ada Lovelace", + score:61, + grade:"D" +},{ + title:"Web Security", + instructor:"Sue Denim", + name:"Ada Lovelace", + score:81, + grade:"B" +},{ + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Ada Lovelace", + score:73, + grade:"C" +},{ + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Ada Lovelace", + score:58, + grade:"F" +},{ + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Ada Lovelace", + score:93, + grade:"A" +},{ + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Ada Lovelace", + score:82, + grade:"B" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Ada Lovelace", + score:88, + grade:"B" +},{ + title:"Networks", + instructor:"Van Emde Boas", + name:"Ada Lovelace", + score:65, + grade:"D" +}]; +export default myCourses; diff --git a/tutorial/03/myData.js b/tutorial/03/myData.js deleted file mode 100644 index f2b6e03..0000000 --- a/tutorial/03/myData.js +++ /dev/null @@ -1 +0,0 @@ -var myData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:91,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"}]; diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index 462d754..d53ab9c 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -91,7 +91,67 @@ Now that we see how `forEach` works, let's use it to make calls to the `console` @action(open('data/myFixed.js')) @action(set( ``` -const myFixed=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:95,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:95,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:85,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:95,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:94,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:95,grade:"A"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:77,grade:"C"}]; +const myFixed = [{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ada Lovelace", + score:95, + grade:"A" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Ada Lovelace", + score:95, + grade:"A" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Ada Lovelace", + score:73, + grade:"C" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Ada Lovelace", + score:93, + grade:"A" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Ada Lovelace", + score:85, + grade:"B" +}, { + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Ada Lovelace", + score:70, + grade:"C" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Ada Lovelace", + score:95, + grade:"A" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Ada Lovelace", + score:94, + grade:"A" +}, { + title:"Data Structures", + instructor:"Brodal Q.", + name:"Ada Lovelace", + score:95, + grade:"A" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Ada Lovelace", + score:77, + grade:"C" +}]; export default myFixed; ``` )) diff --git a/tutorial/04/myFixed.js b/tutorial/04/myFixed.js index 80eae5d..97299a0 100644 --- a/tutorial/04/myFixed.js +++ b/tutorial/04/myFixed.js @@ -1 +1,62 @@ -var myFixed=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ada Lovelace",score:95,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:95,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:85,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:95,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:94,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:95,grade:"A"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:77,grade:"C"}]; +const myFixed = [{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Ada Lovelace", + score:95, + grade:"A" +},{ + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Ada Lovelace", + score:95, + grade:"A" +},{ + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Ada Lovelace", + score:73, + grade:"C" +},{ + title:"Web Security", + instructor:"Sue Denim", + name:"Ada Lovelace", + score:93, + grade:"A" +},{ + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Ada Lovelace", + score:85, + grade:"B" +},{ + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Ada Lovelace", + score:70, + grade:"C" +},{ + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Ada Lovelace", + score:95, + grade:"A" +},{ + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Ada Lovelace", + score:94, + grade:"A" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Ada Lovelace", + score:95, + grade:"A" +},{ + title:"Networks", + instructor:"Van Emde Boas", + name:"Ada Lovelace", + score:77, + grade:"C" +}]; +export default myFixed; diff --git a/tutorial/05/find.md b/tutorial/05/find.md index 017f238..b014a1d 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -30,7 +30,967 @@ Find is great for performantly matching unique values in data, such as an "id", @action(open('data/students2.js')) @action(set( ``` -const students=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"!f",score:91,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Brian Kernaghan",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Danielle Bunten Berry",score:78,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Donald Knuth",score:94,grade:"A"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Grace Hopper",score:36,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"James Gosling",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ken Thompson",score:30,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Linus Torvalds",score:34,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"in",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"dt",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"he",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"be",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"st",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"re",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"ve",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"ng",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"e!",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; +const students = [{ + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "!f", + score: 91, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Albert Gonzalez", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Brian Kernaghan", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Danielle Bunten Berry", + score: 78, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Grace Hopper", + score: 36, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Hack Kerr", + score: 85, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "James Gosling", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ken Thompson", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Kevin Mitnick", + score: 72, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Linus Torvalds", + score: 34, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Rebecca Heineman", + score: 71, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Tim Berners-Lee", + score: 54, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Xiao Tian", + score: 67, + grade: "D" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ying Cracker", + score: 57, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "in", + score: 88, + grade: "B" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Albert Gonzalez", + score: 37, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Brian Kernaghan", + score: 76, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Danielle Bunten Berry", + score: 53, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Donald Knuth", + score: 34, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Grace Hopper", + score: 74, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Hack Kerr", + score: 86, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "James Gosling", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ken Thompson", + score: 48, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Kevin Mitnick", + score: 52, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Linus Torvalds", + score: 90, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Rebecca Heineman", + score: 73, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Tim Berners-Lee", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Xiao Tian", + score: 45, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ying Cracker", + score: 77, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "dt", + score: 61, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Albert Gonzalez", + score: 73, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Brian Kernaghan", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Danielle Bunten Berry", + score: 87, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Donald Knuth", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Grace Hopper", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Hack Kerr", + score: 92, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "James Gosling", + score: 97, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ken Thompson", + score: 64, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Linus Torvalds", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Niklaus Wirth", + score: 93, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Rebecca Heineman", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Tim Berners-Lee", + score: 98, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Xiao Tian", + score: 36, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ying Cracker", + score: 73, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Donald Knuth", + score: 44, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Albert Gonzalez", + score: 74, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Brian Kernaghan", + score: 92, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Danielle Bunten Berry", + score: 34, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "he", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Grace Hopper", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Hack Kerr", + score: 75, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "James Gosling", + score: 95, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ken Thompson", + score: 84, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Kevin Mitnick", + score: 89, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Linus Torvalds", + score: 57, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Niklaus Wirth", + score: 88, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Rebecca Heineman", + score: 93, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Tim Berners-Lee", + score: 36, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ying Cracker", + score: 42, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "be", + score: 73, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Albert Gonzalez", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Brian Kernaghan", + score: 71, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Danielle Bunten Berry", + score: 66, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Grace Hopper", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Hack Kerr", + score: 83, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "James Gosling", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ken Thompson", + score: 65, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Linus Torvalds", + score: 93, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Niklaus Wirth", + score: 50, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Rebecca Heineman", + score: 33, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Tim Berners-Lee", + score: 51, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ying Cracker", + score: 60, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "st", + score: 58, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Albert Gonzalez", + score: 67, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Brian Kernaghan", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Danielle Bunten Berry", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Donald Knuth", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Grace Hopper", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Hack Kerr", + score: 96, + grade: "A" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "James Gosling", + score: 83, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ken Thompson", + score: 35, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Kevin Mitnick", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Linus Torvalds", + score: 63, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Rebecca Heineman", + score: 84, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Tim Berners-Lee", + score: 41, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Xiao Tian", + score: 49, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ying Cracker", + score: 96, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "re", + score: 93, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Albert Gonzalez", + score: 39, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Brian Kernaghan", + score: 69, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Danielle Bunten Berry", + score: 54, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Donald Knuth", + score: 83, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Grace Hopper", + score: 31, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Hack Kerr", + score: 94, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "James Gosling", + score: 35, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ken Thompson", + score: 67, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Kevin Mitnick", + score: 81, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Linus Torvalds", + score: 70, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Niklaus Wirth", + score: 74, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Rebecca Heineman", + score: 92, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Tim Berners-Lee", + score: 48, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Xiao Tian", + score: 80, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ying Cracker", + score: 84, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "ve", + score: 82, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Albert Gonzalez", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Brian Kernaghan", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Donald Knuth", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Grace Hopper", + score: 42, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Hack Kerr", + score: 87, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "James Gosling", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ken Thompson", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Kevin Mitnick", + score: 41, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Linus Torvalds", + score: 76, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Rebecca Heineman", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Tim Berners-Lee", + score: 74, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Xiao Tian", + score: 93, + grade: "A" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ying Cracker", + score: 95, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "ng", + score: 88, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Albert Gonzalez", + score: 56, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Brian Kernaghan", + score: 58, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Donald Knuth", + score: 85, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Grace Hopper", + score: 53, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Hack Kerr", + score: 89, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "James Gosling", + score: 42, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ken Thompson", + score: 87, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Kevin Mitnick", + score: 40, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Linus Torvalds", + score: 91, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Niklaus Wirth", + score: 51, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Rebecca Heineman", + score: 79, + grade: "C" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Tim Berners-Lee", + score: 37, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Xiao Tian", + score: 84, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ying Cracker", + score: 45, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "e!", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Albert Gonzalez", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Brian Kernaghan", + score: 61, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Danielle Bunten Berry", + score: 59, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Donald Knuth", + score: 89, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Grace Hopper", + score: 40, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Hack Kerr", + score: 102, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "James Gosling", + score: 39, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ken Thompson", + score: 83, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Kevin Mitnick", + score: 37, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Linus Torvalds", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Niklaus Wirth", + score: 36, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Rebecca Heineman", + score: 32, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Tim Berners-Lee", + score: 70, + grade: "C" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Xiao Tian", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ying Cracker", + score: 62, + grade: "D" +}]; export default students; ``` )) diff --git a/tutorial/05/students2.js b/tutorial/05/students2.js new file mode 100644 index 0000000..3daf28b --- /dev/null +++ b/tutorial/05/students2.js @@ -0,0 +1,962 @@ +const students = [{ + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "!f", + score: 91, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Albert Gonzalez", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Brian Kernaghan", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Danielle Bunten Berry", + score: 78, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Grace Hopper", + score: 36, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Hack Kerr", + score: 85, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "James Gosling", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ken Thompson", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Kevin Mitnick", + score: 72, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Linus Torvalds", + score: 34, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Rebecca Heineman", + score: 71, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Tim Berners-Lee", + score: 54, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Xiao Tian", + score: 67, + grade: "D" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ying Cracker", + score: 57, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "in", + score: 88, + grade: "B" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Albert Gonzalez", + score: 37, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Brian Kernaghan", + score: 76, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Danielle Bunten Berry", + score: 53, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Donald Knuth", + score: 34, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Grace Hopper", + score: 74, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Hack Kerr", + score: 86, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "James Gosling", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ken Thompson", + score: 48, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Kevin Mitnick", + score: 52, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Linus Torvalds", + score: 90, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Rebecca Heineman", + score: 73, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Tim Berners-Lee", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Xiao Tian", + score: 45, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ying Cracker", + score: 77, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "dt", + score: 61, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Albert Gonzalez", + score: 73, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Brian Kernaghan", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Danielle Bunten Berry", + score: 87, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Donald Knuth", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Grace Hopper", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Hack Kerr", + score: 92, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "James Gosling", + score: 97, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ken Thompson", + score: 64, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Linus Torvalds", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Niklaus Wirth", + score: 93, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Rebecca Heineman", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Tim Berners-Lee", + score: 98, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Xiao Tian", + score: 36, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ying Cracker", + score: 73, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Donald Knuth", + score: 44, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Albert Gonzalez", + score: 74, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Brian Kernaghan", + score: 92, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Danielle Bunten Berry", + score: 34, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "he", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Grace Hopper", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Hack Kerr", + score: 75, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "James Gosling", + score: 95, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ken Thompson", + score: 84, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Kevin Mitnick", + score: 89, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Linus Torvalds", + score: 57, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Niklaus Wirth", + score: 88, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Rebecca Heineman", + score: 93, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Tim Berners-Lee", + score: 36, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ying Cracker", + score: 42, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "be", + score: 73, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Albert Gonzalez", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Brian Kernaghan", + score: 71, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Danielle Bunten Berry", + score: 66, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Grace Hopper", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Hack Kerr", + score: 83, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "James Gosling", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ken Thompson", + score: 65, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Linus Torvalds", + score: 93, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Niklaus Wirth", + score: 50, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Rebecca Heineman", + score: 33, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Tim Berners-Lee", + score: 51, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ying Cracker", + score: 60, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "st", + score: 58, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Albert Gonzalez", + score: 67, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Brian Kernaghan", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Danielle Bunten Berry", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Donald Knuth", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Grace Hopper", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Hack Kerr", + score: 96, + grade: "A" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "James Gosling", + score: 83, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ken Thompson", + score: 35, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Kevin Mitnick", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Linus Torvalds", + score: 63, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Rebecca Heineman", + score: 84, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Tim Berners-Lee", + score: 41, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Xiao Tian", + score: 49, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ying Cracker", + score: 96, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "re", + score: 93, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Albert Gonzalez", + score: 39, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Brian Kernaghan", + score: 69, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Danielle Bunten Berry", + score: 54, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Donald Knuth", + score: 83, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Grace Hopper", + score: 31, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Hack Kerr", + score: 94, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "James Gosling", + score: 35, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ken Thompson", + score: 67, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Kevin Mitnick", + score: 81, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Linus Torvalds", + score: 70, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Niklaus Wirth", + score: 74, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Rebecca Heineman", + score: 92, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Tim Berners-Lee", + score: 48, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Xiao Tian", + score: 80, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ying Cracker", + score: 84, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "ve", + score: 82, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Albert Gonzalez", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Brian Kernaghan", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Donald Knuth", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Grace Hopper", + score: 42, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Hack Kerr", + score: 87, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "James Gosling", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ken Thompson", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Kevin Mitnick", + score: 41, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Linus Torvalds", + score: 76, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Rebecca Heineman", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Tim Berners-Lee", + score: 74, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Xiao Tian", + score: 93, + grade: "A" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ying Cracker", + score: 95, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "ng", + score: 88, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Albert Gonzalez", + score: 56, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Brian Kernaghan", + score: 58, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Donald Knuth", + score: 85, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Grace Hopper", + score: 53, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Hack Kerr", + score: 89, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "James Gosling", + score: 42, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ken Thompson", + score: 87, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Kevin Mitnick", + score: 40, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Linus Torvalds", + score: 91, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Niklaus Wirth", + score: 51, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Rebecca Heineman", + score: 79, + grade: "C" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Tim Berners-Lee", + score: 37, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Xiao Tian", + score: 84, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ying Cracker", + score: 45, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "e!", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Albert Gonzalez", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Brian Kernaghan", + score: 61, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Danielle Bunten Berry", + score: 59, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Donald Knuth", + score: 89, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Grace Hopper", + score: 40, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Hack Kerr", + score: 102, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "James Gosling", + score: 39, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ken Thompson", + score: 83, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Kevin Mitnick", + score: 37, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Linus Torvalds", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Niklaus Wirth", + score: 36, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Rebecca Heineman", + score: 32, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Tim Berners-Lee", + score: 70, + grade: "C" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Xiao Tian", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ying Cracker", + score: 62, + grade: "D" +}]; +export default students; diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index 2dc8c78..eb021a6 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -100,7 +100,687 @@ We'll test out flatten, then re-create our student array of data from the origin @action(open('data/courses2.js')) @action(set( ``` -const courses=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",students:[{name:"!f",score:61,grade:"D"},{name:"Albert Gonzalez",score:35,grade:"F"},{name:"Brian Kernaghan",score:35,grade:"F"},{name:"Danielle Bunten Berry",score:78,grade:"C"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:36,grade:"F"},{name:"Hack Kerr",score:85,grade:"F"},{name:"James Gosling",score:30,grade:"F"},{name:"Ken Thompson",score:30,grade:"F"},{name:"Kevin Mitnick",score:72,grade:"C"},{name:"Linus Torvalds",score:34,grade:"F"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:71,grade:"C"},{name:"Tim Berners-Lee",score:54,grade:"F"},{name:"Xiao Tian",score:67,grade:"D"},{name:"Ying Cracker",score:57,grade:"F"}]},{title:"3D Computer Graphics",instructor:"G.L. Webb",students:[{name:"in",score:58,grade:"F"},{name:"Albert Gonzalez",score:37,grade:"F"},{name:"Brian Kernaghan",score:76,grade:"C"},{name:"Danielle Bunten Berry",score:53,grade:"F"},{name:"Donald Knuth",score:34,grade:"F"},{name:"Grace Hopper",score:74,grade:"C"},{name:"Hack Kerr",score:86,grade:"F"},{name:"James Gosling",score:94,grade:"A"},{name:"Ken Thompson",score:48,grade:"F"},{name:"Kevin Mitnick",score:52,grade:"F"},{name:"Linus Torvalds",score:90,grade:"A"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:73,grade:"C"},{name:"Tim Berners-Lee",score:94,grade:"A"},{name:"Xiao Tian",score:45,grade:"F"},{name:"Ying Cracker",score:77,grade:"C"}]},{title:"Front End Web Development",instructor:"Moe Zaick",students:[{name:"dt",score:31,grade:"F"},{name:"Albert Gonzalez",score:73,grade:"C"},{name:"Brian Kernaghan",score:47,grade:"F"},{name:"Danielle Bunten Berry",score:87,grade:"B"},{name:"Donald Knuth",score:80,grade:"B"},{name:"Grace Hopper",score:80,grade:"B"},{name:"Hack Kerr",score:92,grade:"C"},{name:"James Gosling",score:97,grade:"A"},{name:"Ken Thompson",score:64,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:58,grade:"F"},{name:"Niklaus Wirth",score:93,grade:"A"},{name:"Rebecca Heineman",score:58,grade:"F"},{name:"Tim Berners-Lee",score:98,grade:"A"},{name:"Xiao Tian",score:36,grade:"F"},{name:"Ying Cracker",score:73,grade:"C"}]},{title:"Web Security",instructor:"Sue Denim",students:[{name:"he",score:51,grade:"F"},{name:"Albert Gonzalez",score:74,grade:"C"},{name:"Brian Kernaghan",score:92,grade:"A"},{name:"Danielle Bunten Berry",score:34,grade:"F"},{name:"Donald Knuth",score:44,grade:"F"},{name:"Grace Hopper",score:81,grade:"B"},{name:"Hack Kerr",score:75,grade:"F"},{name:"James Gosling",score:95,grade:"A"},{name:"Ken Thompson",score:84,grade:"B"},{name:"Kevin Mitnick",score:89,grade:"B"},{name:"Linus Torvalds",score:57,grade:"F"},{name:"Niklaus Wirth",score:88,grade:"B"},{name:"Rebecca Heineman",score:93,grade:"A"},{name:"Tim Berners-Lee",score:36,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:42,grade:"F"}]},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",students:[{name:"be",score:43,grade:"F"},{name:"Albert Gonzalez",score:94,grade:"A"},{name:"Brian Kernaghan",score:71,grade:"C"},{name:"Danielle Bunten Berry",score:66,grade:"D"},{name:"Donald Knuth",score:94,grade:"A"},{name:"Grace Hopper",score:99,grade:"A"},{name:"Hack Kerr",score:83,grade:"F"},{name:"James Gosling",score:99,grade:"A"},{name:"Ken Thompson",score:65,grade:"D"},{name:"Kevin Mitnick",score:47,grade:"F"},{name:"Linus Torvalds",score:93,grade:"A"},{name:"Niklaus Wirth",score:50,grade:"F"},{name:"Rebecca Heineman",score:33,grade:"F"},{name:"Tim Berners-Lee",score:51,grade:"F"},{name:"Xiao Tian",score:87,grade:"B"},{name:"Ying Cracker",score:60,grade:"D"}]},{title:"Data Science",instructor:"Ford Fulkerson",students:[{name:"st",score:28,grade:"F"},{name:"Albert Gonzalez",score:67,grade:"D"},{name:"Brian Kernaghan",score:66,grade:"D"},{name:"Danielle Bunten Berry",score:36,grade:"F"},{name:"Donald Knuth",score:36,grade:"F"},{name:"Grace Hopper",score:66,grade:"D"},{name:"Hack Kerr",score:96,grade:"A"},{name:"James Gosling",score:83,grade:"B"},{name:"Ken Thompson",score:35,grade:"F"},{name:"Kevin Mitnick",score:75,grade:"C"},{name:"Linus Torvalds",score:63,grade:"D"},{name:"Niklaus Wirth",score:75,grade:"C"},{name:"Rebecca Heineman",score:84,grade:"B"},{name:"Tim Berners-Lee",score:41,grade:"F"},{name:"Xiao Tian",score:49,grade:"F"},{name:"Ying Cracker",score:96,grade:"A"}]},{title:"Algorithm Design",instructor:"Gale Shapely",students:[{name:"re",score:63,grade:"D"},{name:"Albert Gonzalez",score:39,grade:"F"},{name:"Brian Kernaghan",score:69,grade:"D"},{name:"Danielle Bunten Berry",score:54,grade:"F"},{name:"Donald Knuth",score:83,grade:"B"},{name:"Grace Hopper",score:31,grade:"F"},{name:"Hack Kerr",score:94,grade:"A"},{name:"James Gosling",score:35,grade:"F"},{name:"Ken Thompson",score:67,grade:"D"},{name:"Kevin Mitnick",score:81,grade:"B"},{name:"Linus Torvalds",score:70,grade:"C"},{name:"Niklaus Wirth",score:74,grade:"C"},{name:"Rebecca Heineman",score:92,grade:"A"},{name:"Tim Berners-Lee",score:48,grade:"F"},{name:"Xiao Tian",score:80,grade:"B"},{name:"Ying Cracker",score:84,grade:"B"}]},{title:"Data Abstraction",instructor:"Aster Ricks",students:[{name:"ve",score:52,grade:"F"},{name:"Albert Gonzalez",score:70,grade:"C"},{name:"Brian Kernaghan",score:89,grade:"B"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:86,grade:"B"},{name:"Grace Hopper",score:42,grade:"F"},{name:"Hack Kerr",score:87,grade:"F"},{name:"James Gosling",score:89,grade:"B"},{name:"Ken Thompson",score:86,grade:"B"},{name:"Kevin Mitnick",score:41,grade:"F"},{name:"Linus Torvalds",score:76,grade:"C"},{name:"Niklaus Wirth",score:78,grade:"C"},{name:"Rebecca Heineman",score:70,grade:"C"},{name:"Tim Berners-Lee",score:74,grade:"C"},{name:"Xiao Tian",score:93,grade:"A"},{name:"Ying Cracker",score:95,grade:"A"}]},{title:"Data Structures",instructor:"Brodal Q.",students:[{name:"ng",score:58,grade:"F"},{name:"Albert Gonzalez",score:56,grade:"F"},{name:"Brian Kernaghan",score:58,grade:"F"},{name:"Danielle Bunten Berry",score:38,grade:"F"},{name:"Donald Knuth",score:85,grade:"B"},{name:"Grace Hopper",score:53,grade:"F"},{name:"Hack Kerr",score:89,grade:"B"},{name:"James Gosling",score:42,grade:"F"},{name:"Ken Thompson",score:87,grade:"B"},{name:"Kevin Mitnick",score:40,grade:"F"},{name:"Linus Torvalds",score:91,grade:"A"},{name:"Niklaus Wirth",score:51,grade:"F"},{name:"Rebecca Heineman",score:79,grade:"C"},{name:"Tim Berners-Lee",score:37,grade:"F"},{name:"Xiao Tian",score:84,grade:"B"},{name:"Ying Cracker",score:45,grade:"F"}]},{title:"Networks",instructor:"Van Emde Boas",students:[{name:"e!",score:35,grade:"F"},{name:"Albert Gonzalez",score:52,grade:"F"},{name:"Brian Kernaghan",score:61,grade:"D"},{name:"Danielle Bunten Berry",score:59,grade:"F"},{name:"Donald Knuth",score:89,grade:"B"},{name:"Grace Hopper",score:40,grade:"F"},{name:"Hack Kerr",score:102,grade:"F"},{name:"James Gosling",score:39,grade:"F"},{name:"Ken Thompson",score:83,grade:"B"},{name:"Kevin Mitnick",score:37,grade:"F"},{name:"Linus Torvalds",score:65,grade:"D"},{name:"Niklaus Wirth",score:36,grade:"F"},{name:"Rebecca Heineman",score:32,grade:"F"},{name:"Tim Berners-Lee",score:70,grade:"C"},{name:"Xiao Tian",score:52,grade:"F"},{name:"Ying Cracker",score:62,grade:"D"}]}]; +const courses = [{ + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + students: [{ + name: "!f", + score: 61, + grade: "D" + }, { + name: "Albert Gonzalez", + score: 35, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 35, + grade: "F" + }, { + name: "Danielle Bunten Berry", + score: 78, + grade: "C" + }, { + name: "Donald Knuth", + score: 94, + grade: "A" + }, { + name: "Grace Hopper", + score: 36, + grade: "F" + }, { + name: "Hack Kerr", + score: 85, + grade: "F" + }, { + name: "James Gosling", + score: 30, + grade: "F" + }, { + name: "Ken Thompson", + score: 30, + grade: "F" + }, { + name: "Kevin Mitnick", + score: 72, + grade: "C" + }, { + name: "Linus Torvalds", + score: 34, + grade: "F" + }, { + name: "Niklaus Wirth", + score: 75, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 71, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 54, + grade: "F" + }, { + name: "Xiao Tian", + score: 67, + grade: "D" + }, { + name: "Ying Cracker", + score: 57, + grade: "F" + }] +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + students: [{ + name: "in", + score: 58, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 37, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 76, + grade: "C" + }, { + name: "Danielle Bunten Berry", + score: 53, + grade: "F" + }, { + name: "Donald Knuth", + score: 34, + grade: "F" + }, { + name: "Grace Hopper", + score: 74, + grade: "C" + }, { + name: "Hack Kerr", + score: 86, + grade: "F" + }, { + name: "James Gosling", + score: 94, + grade: "A" + }, { + name: "Ken Thompson", + score: 48, + grade: "F" + }, { + name: "Kevin Mitnick", + score: 52, + grade: "F" + }, { + name: "Linus Torvalds", + score: 90, + grade: "A" + }, { + name: "Niklaus Wirth", + score: 78, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 73, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 94, + grade: "A" + }, { + name: "Xiao Tian", + score: 45, + grade: "F" + }, { + name: "Ying Cracker", + score: 77, + grade: "C" + }] +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + students: [{ + name: "dt", + score: 31, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 73, + grade: "C" + }, { + name: "Brian Kernaghan", + score: 47, + grade: "F" + }, { + name: "Danielle Bunten Berry", + score: 87, + grade: "B" + }, { + name: "Donald Knuth", + score: 80, + grade: "B" + }, { + name: "Grace Hopper", + score: 80, + grade: "B" + }, { + name: "Hack Kerr", + score: 92, + grade: "C" + }, { + name: "James Gosling", + score: 97, + grade: "A" + }, { + name: "Ken Thompson", + score: 64, + grade: "D" + }, { + name: "Kevin Mitnick", + score: 47, + grade: "F" + }, { + name: "Linus Torvalds", + score: 58, + grade: "F" + }, { + name: "Niklaus Wirth", + score: 93, + grade: "A" + }, { + name: "Rebecca Heineman", + score: 58, + grade: "F" + }, { + name: "Tim Berners-Lee", + score: 98, + grade: "A" + }, { + name: "Xiao Tian", + score: 36, + grade: "F" + }, { + name: "Ying Cracker", + score: 73, + grade: "C" + }] +}, { + title: "Web Security", + instructor: "Sue Denim", + students: [{ + name: "he", + score: 51, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 74, + grade: "C" + }, { + name: "Brian Kernaghan", + score: 92, + grade: "A" + }, { + name: "Danielle Bunten Berry", + score: 34, + grade: "F" + }, { + name: "Donald Knuth", + score: 44, + grade: "F" + }, { + name: "Grace Hopper", + score: 81, + grade: "B" + }, { + name: "Hack Kerr", + score: 75, + grade: "F" + }, { + name: "James Gosling", + score: 95, + grade: "A" + }, { + name: "Ken Thompson", + score: 84, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 89, + grade: "B" + }, { + name: "Linus Torvalds", + score: 57, + grade: "F" + }, { + name: "Niklaus Wirth", + score: 88, + grade: "B" + }, { + name: "Rebecca Heineman", + score: 93, + grade: "A" + }, { + name: "Tim Berners-Lee", + score: 36, + grade: "F" + }, { + name: "Xiao Tian", + score: 87, + grade: "B" + }, { + name: "Ying Cracker", + score: 42, + grade: "F" + }] +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + students: [{ + name: "be", + score: 43, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 94, + grade: "A" + }, { + name: "Brian Kernaghan", + score: 71, + grade: "C" + }, { + name: "Danielle Bunten Berry", + score: 66, + grade: "D" + }, { + name: "Donald Knuth", + score: 94, + grade: "A" + }, { + name: "Grace Hopper", + score: 99, + grade: "A" + }, { + name: "Hack Kerr", + score: 83, + grade: "F" + }, { + name: "James Gosling", + score: 99, + grade: "A" + }, { + name: "Ken Thompson", + score: 65, + grade: "D" + }, { + name: "Kevin Mitnick", + score: 47, + grade: "F" + }, { + name: "Linus Torvalds", + score: 93, + grade: "A" + }, { + name: "Niklaus Wirth", + score: 50, + grade: "F" + }, { + name: "Rebecca Heineman", + score: 33, + grade: "F" + }, { + name: "Tim Berners-Lee", + score: 51, + grade: "F" + }, { + name: "Xiao Tian", + score: 87, + grade: "B" + }, { + name: "Ying Cracker", + score: 60, + grade: "D" + }] +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + students: [{ + name: "st", + score: 28, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 67, + grade: "D" + }, { + name: "Brian Kernaghan", + score: 66, + grade: "D" + }, { + name: "Danielle Bunten Berry", + score: 36, + grade: "F" + }, { + name: "Donald Knuth", + score: 36, + grade: "F" + }, { + name: "Grace Hopper", + score: 66, + grade: "D" + }, { + name: "Hack Kerr", + score: 96, + grade: "A" + }, { + name: "James Gosling", + score: 83, + grade: "B" + }, { + name: "Ken Thompson", + score: 35, + grade: "F" + }, { + name: "Kevin Mitnick", + score: 75, + grade: "C" + }, { + name: "Linus Torvalds", + score: 63, + grade: "D" + }, { + name: "Niklaus Wirth", + score: 75, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 84, + grade: "B" + }, { + name: "Tim Berners-Lee", + score: 41, + grade: "F" + }, { + name: "Xiao Tian", + score: 49, + grade: "F" + }, { + name: "Ying Cracker", + score: 96, + grade: "A" + }] +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + students: [{ + name: "re", + score: 63, + grade: "D" + }, { + name: "Albert Gonzalez", + score: 39, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 69, + grade: "D" + }, { + name: "Danielle Bunten Berry", + score: 54, + grade: "F" + }, { + name: "Donald Knuth", + score: 83, + grade: "B" + }, { + name: "Grace Hopper", + score: 31, + grade: "F" + }, { + name: "Hack Kerr", + score: 94, + grade: "A" + }, { + name: "James Gosling", + score: 35, + grade: "F" + }, { + name: "Ken Thompson", + score: 67, + grade: "D" + }, { + name: "Kevin Mitnick", + score: 81, + grade: "B" + }, { + name: "Linus Torvalds", + score: 70, + grade: "C" + }, { + name: "Niklaus Wirth", + score: 74, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 92, + grade: "A" + }, { + name: "Tim Berners-Lee", + score: 48, + grade: "F" + }, { + name: "Xiao Tian", + score: 80, + grade: "B" + }, { + name: "Ying Cracker", + score: 84, + grade: "B" + }] +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + students: [{ + name: "ve", + score: 52, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 70, + grade: "C" + }, { + name: "Brian Kernaghan", + score: 89, + grade: "B" + }, { + name: "Danielle Bunten Berry", + score: 38, + grade: "F" + }, { + name: "Donald Knuth", + score: 86, + grade: "B" + }, { + name: "Grace Hopper", + score: 42, + grade: "F" + }, { + name: "Hack Kerr", + score: 87, + grade: "F" + }, { + name: "James Gosling", + score: 89, + grade: "B" + }, { + name: "Ken Thompson", + score: 86, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 41, + grade: "F" + }, { + name: "Linus Torvalds", + score: 76, + grade: "C" + }, { + name: "Niklaus Wirth", + score: 78, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 70, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 74, + grade: "C" + }, { + name: "Xiao Tian", + score: 93, + grade: "A" + }, { + name: "Ying Cracker", + score: 95, + grade: "A" + }] +}, { + title: "Data Structures", + instructor: "Brodal Q.", + students: [{ + name: "ng", + score: 58, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 56, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 58, + grade: "F" + }, { + name: "Danielle Bunten Berry", + score: 38, + grade: "F" + }, { + name: "Donald Knuth", + score: 85, + grade: "B" + }, { + name: "Grace Hopper", + score: 53, + grade: "F" + }, { + name: "Hack Kerr", + score: 89, + grade: "B" + }, { + name: "James Gosling", + score: 42, + grade: "F" + }, { + name: "Ken Thompson", + score: 87, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 40, + grade: "F" + }, { + name: "Linus Torvalds", + score: 91, + grade: "A" + }, { + name: "Niklaus Wirth", + score: 51, + grade: "F" + }, { + name: "Rebecca Heineman", + score: 79, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 37, + grade: "F" + }, { + name: "Xiao Tian", + score: 84, + grade: "B" + }, { + name: "Ying Cracker", + score: 45, + grade: "F" + }] +}, { + title: "Networks", + instructor: "Van Emde Boas", + students: [{ + name: "e!", + score: 35, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 52, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 61, + grade: "D" + }, { + name: "Danielle Bunten Berry", + score: 59, + grade: "F" + }, { + name: "Donald Knuth", + score: 89, + grade: "B" + }, { + name: "Grace Hopper", + score: 40, + grade: "F" + }, { + name: "Hack Kerr", + score: 102, + grade: "F" + }, { + name: "James Gosling", + score: 39, + grade: "F" + }, { + name: "Ken Thompson", + score: 83, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 37, + grade: "F" + }, { + name: "Linus Torvalds", + score: 65, + grade: "D" + }, { + name: "Niklaus Wirth", + score: 36, + grade: "F" + }, { + name: "Rebecca Heineman", + score: 32, + grade: "F" + }, { + name: "Tim Berners-Lee", + score: 70, + grade: "C" + }, { + name: "Xiao Tian", + score: 52, + grade: "F" + }, { + name: "Ying Cracker", + score: 62, + grade: "D" + }] +}]; export default courses; ``` )) diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index 5c67544..ba67750 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -94,7 +94,187 @@ var averages = courses.map(function(course) { @action(open('data/suspectData.js')) @action(set( ``` -const suspectData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"}]; +const suspectData = [{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Albert Gonzalez", + score:35, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Hack Kerr", + score:85, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Kevin Mitnick", + score:72, + grade:"C" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Albert Gonzalez", + score:37, + grade:"F" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Hack Kerr", + score:86, + grade:"F" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Kevin Mitnick", + score:52, + grade:"F" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Albert Gonzalez", + score:73, + grade:"C" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Hack Kerr", + score:92, + grade:"C" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Kevin Mitnick", + score:47, + grade:"F" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Albert Gonzalez", + score:74, + grade:"C" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Hack Kerr", + score:75, + grade:"F" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Kevin Mitnick", + score:89, + grade:"B" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Albert Gonzalez", + score:94, + grade:"A" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Hack Kerr", + score:83, + grade:"F" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Kevin Mitnick", + score:47, + grade:"F" +},{ + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Albert Gonzalez", + score:67, + grade:"D" +}, { + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Hack Kerr", + score:96, + grade:"A" +}, { + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Kevin Mitnick", + score:75, + grade:"C" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Albert Gonzalez", + score:39, + grade:"F" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Hack Kerr", + score:94, + grade:"A" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Kevin Mitnick", + score:81, + grade:"B" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Albert Gonzalez", + score:70, + grade:"C" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Hack Kerr", + score:87, + grade:"F" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Kevin Mitnick", + score:41, + grade:"F" +}, { + title:"Data Structures", + instructor:"Brodal Q.", + name:"Albert Gonzalez", + score:56, + grade:"F" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Hack Kerr", + score:89, + grade:"B" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Kevin Mitnick", + score:40, + grade:"F" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Albert Gonzalez", + score:52, + grade:"F" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Hack Kerr", + score:102, + grade:"F" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Kevin Mitnick", + score:37, + grade:"F" +}]; export default suspectData; ``` )) diff --git a/tutorial/07/suspectData.js b/tutorial/07/suspectData.js index c5db90c..180fddb 100644 --- a/tutorial/07/suspectData.js +++ b/tutorial/07/suspectData.js @@ -1 +1,182 @@ -var suspectData=[{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Albert Gonzalez",score:35,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Hack Kerr",score:85,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Kevin Mitnick",score:72,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"}]; +const suspectData = [{ + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Albert Gonzalez", + score:35, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Hack Kerr", + score:85, + grade:"F" +}, { + title:"Relational Databases", + instructor:"Sean Quentin Lewis", + name:"Kevin Mitnick", + score:72, + grade:"C" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Albert Gonzalez", + score:37, + grade:"F" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Hack Kerr", + score:86, + grade:"F" +}, { + title:"3D Computer Graphics", + instructor:"G.L. Webb", + name:"Kevin Mitnick", + score:52, + grade:"F" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Albert Gonzalez", + score:73, + grade:"C" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Hack Kerr", + score:92, + grade:"C" +}, { + title:"Front End Web Development", + instructor:"Moe Zaick", + name:"Kevin Mitnick", + score:47, + grade:"F" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Albert Gonzalez", + score:74, + grade:"C" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Hack Kerr", + score:75, + grade:"F" +}, { + title:"Web Security", + instructor:"Sue Denim", + name:"Kevin Mitnick", + score:89, + grade:"B" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Albert Gonzalez", + score:94, + grade:"A" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Hack Kerr", + score:83, + grade:"F" +}, { + title:"Javascript Fundamentals", + instructor:"Jay Kweerie", + name:"Kevin Mitnick", + score:47, + grade:"F" +},{ + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Albert Gonzalez", + score:67, + grade:"D" +}, { + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Hack Kerr", + score:96, + grade:"A" +}, { + title:"Data Science", + instructor:"Ford Fulkerson", + name:"Kevin Mitnick", + score:75, + grade:"C" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Albert Gonzalez", + score:39, + grade:"F" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Hack Kerr", + score:94, + grade:"A" +}, { + title:"Algorithm Design", + instructor:"Gale Shapely", + name:"Kevin Mitnick", + score:81, + grade:"B" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Albert Gonzalez", + score:70, + grade:"C" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Hack Kerr", + score:87, + grade:"F" +}, { + title:"Data Abstraction", + instructor:"Aster Ricks", + name:"Kevin Mitnick", + score:41, + grade:"F" +}, { + title:"Data Structures", + instructor:"Brodal Q.", + name:"Albert Gonzalez", + score:56, + grade:"F" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Hack Kerr", + score:89, + grade:"B" +},{ + title:"Data Structures", + instructor:"Brodal Q.", + name:"Kevin Mitnick", + score:40, + grade:"F" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Albert Gonzalez", + score:52, + grade:"F" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Hack Kerr", + score:102, + grade:"F" +}, { + title:"Networks", + instructor:"Van Emde Boas", + name:"Kevin Mitnick", + score:37, + grade:"F" +}]; +export default suspectData; From 4fee611c3ddaba2ba4a6816516c87d4d6ab45235 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 9 Aug 2016 11:16:19 -0700 Subject: [PATCH 34/46] update vars -> const or let --- README.md | 120 +----------------------- coderoad.json | 208 ++++------------------------------------- tutorial/00/02.js | 2 +- tutorial/00/03.js | 2 +- tutorial/01/01.js | 2 +- tutorial/01/02.js | 4 +- tutorial/01/03.js | 2 +- tutorial/01/04.js | 4 +- tutorial/01/filter.md | 12 +-- tutorial/02/02.js | 2 +- tutorial/02/05.js | 4 +- tutorial/02/sort.md | 2 +- tutorial/03/02.js | 2 +- tutorial/03/03.js | 4 +- tutorial/03/04.js | 2 +- tutorial/03/05.js | 2 +- tutorial/03/06.js | 20 +--- tutorial/03/07.js | 2 +- tutorial/03/map.md | 55 ++++++----- tutorial/04/forEach.md | 4 +- tutorial/05/02.js | 2 +- tutorial/05/03.js | 2 +- tutorial/05/04.js | 2 +- tutorial/05/05.js | 2 +- tutorial/05/06.js | 2 +- tutorial/05/find.md | 14 +-- tutorial/06/02.js | 2 +- tutorial/06/03.js | 2 +- tutorial/06/04.js | 2 +- tutorial/06/05.js | 2 +- tutorial/06/06.js | 4 +- tutorial/06/concat.md | 20 ++-- tutorial/07/01.js | 2 +- tutorial/07/02.js | 2 +- tutorial/07/04.js | 2 +- tutorial/07/05.js | 2 +- tutorial/07/06.js | 2 +- tutorial/07/07.js | 2 +- tutorial/07/reduce.md | 20 ++-- tutorial/tutorial.md | 6 +- 40 files changed, 129 insertions(+), 420 deletions(-) diff --git a/README.md b/README.md index 4ac44d0..d09edc7 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ Keywords: javascript, functional Length: 1-2 hours + + + @@ -29,123 +32,6 @@ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. L ## Outline -##### Start - -Understanding the Data Set - -Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. - -```json -var students = [ - { - "title": "Relational Databases", - "instructor": "Sean Quentin Lewis", - "name": "Ada Lovelace", - "score": 91, - "grade": "A" - }, - ... -] -``` - -Here we have an array of "student" objects. To get the first item in the array, you can use the array index. Array indexes start at 0. - -```js -console.log( - 'first instructor', students[0].instructor -); -// first instructor Sean Quentin Lewis -``` - -##### Filter - -Array -> Array of items that match a condition - -You've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card. - -It would be great if you could `filter` the scores that your parents will see. - -`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below: - -``` -function isA(x) { - return x === 'a'; -} -``` - - -Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). - -``` -var list = ['a', 'b']; -list.filter(isA); - -// if isA(list[0]), add to output array -// if isA(list[1]), add to output array -// -//> ['a'] -``` - -If your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below. - -``` -function isB(x) { - return x.item === 'b' -} - -var list = [{item: 'a'}, {item: 'b'}]; -list.filter(isB); -//> [{item: 'b'}] -``` - -Where were we? Back to filtering our grades. - -There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: - -``` -console.log(students[0]); -//> { course: 'Web Security', -// instructor: 'Sue Denim', -// name: 'Rebecca Heineman', -// score: 93, -// grade: 'A' } -``` - -##### Sort - -Array -> sorted Array - -Your grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through. - -You can use the array method `sort` to arrange your data. Let's see how it works. - -```js -['c', 'b', 'a'].sort(); -//> ['a', 'b', 'c'] - -[3, 2, 1].sort(); -//> [1, 2, 3] -``` - -But what about sorting scores inside of an object? - -```js -[{a: 3}, {a: 1}, {a: 2}].sort(); -//> [{a: 3}, {a: 1}, {a: 2}] -``` - -That didn't work. Instead, you can write a custom `compareScore` function. - -A sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array: - - * -1 : sort to a lower index (front) - * 1 : sort to a higher index (back) - * 0 : stay the same - -Alright, now time to sort your best grades to the top. - -First you'll need to write a sort condition function called `compareScore`. - ##### Map Array -> run a function over each item -> Array diff --git a/coderoad.json b/coderoad.json index 41de977..62c7836 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,182 +1,9 @@ { "info": { "title": "Functional School", - "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n" + "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n\n\n\n" }, "pages": [ - { - "title": "Start", - "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", - "tasks": [ - { - "description": "Load the student data into \"students.js\"", - "tests": [ - "00/01" - ], - "actions": [ - "open('data/students.js')", - "set('const students = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Albert Gonzalez\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Brian Kernaghan\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Danielle Bunten Berry\",\n score:78,\n grade:\"C\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Donald Knuth\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Grace Hopper\",\n score:36,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Hack Kerr\",\n score:85,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"James Gosling\",\n score:30,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ken Thompson\",\n score:30,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Kevin Mitnick\",\n score:72,\n grade:\"C\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Linus Torvalds\",\n score:34,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ada Lovelace\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ada Lovelace\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ada Lovelace\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ada Lovelace\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ada Lovelace\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ada Lovelace\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ada Lovelace\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ada Lovelace\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n\n')" - ] - }, - { - "description": "Set `first` to the first item in the `students` array.", - "tests": [ - "00/02" - ], - "actions": [ - "open('00-setup.js')", - "set('// Welcome to CodeRoad!\nimport students from './data/students';\n\nvar first = ::>\n')" - ], - "hints": [ - "Get the first item in students using the array index", - "Access the title of `students[0]`" - ] - }, - { - "description": "Set `myName` to the \"name\" of the first student in the list.", - "tests": [ - "00/03" - ], - "actions": [ - "insert('var myName = ::>\n')" - ], - "hints": [ - "Get the first \"name\" in the students using the array index", - "Access the \"name\" of `first`", - "Try `first.name`" - ] - }, - { - "description": "Log your name to the console.", - "tests": [ - "00/04" - ], - "actions": [ - "insert('\nconsole.log(::>);\n')" - ], - "hints": [ - "Use `console.log`", - "Use `console.log(myName)`" - ] - } - ], - "onPageComplete": "Now we're ready to get started with `filter`ing our data." - }, - { - "title": "Filter", - "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nvar list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nvar list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", - "tasks": [ - { - "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", - "tests": [ - "01/01" - ], - "actions": [ - "open('01-filter.js')", - "set('import students from './data/students';\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" - ], - "hints": [ - "Some tasks have hints", - "Check if `student.name` matches \"Ada Lovelace\"", - "Use `===` to check equality" - ] - }, - { - "description": "Set `var myData` to filter with the `isAda` function.", - "tests": [ - "01/02" - ], - "actions": [ - "insert('// run the function name in filter\nvar myData = students.filter(::>);\n')" - ], - "hints": [ - "Add a function to the `filter` call: `Array.filter(function() {})`", - "Pass `isAda` into your `filter` call" - ] - }, - { - "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", - "tests": [ - "01/03" - ], - "actions": [ - "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" - ], - "hints": [ - "match for `student.grade` that isn't \"D\" or \"F\"", - "use `!==` to check non-equality", - "Match for both: `student.grade !== \"D\" && student.grade !== \"F\"`" - ] - }, - { - "description": "Set `var myBest` to your scores, excluding any grades that are \"D\" or \"F\".", - "tests": [ - "01/04" - ], - "actions": [ - "insert('// filter out \"D\"'s and \"F\"'s here\nvar myBest = myData.filter(::>);\n\n')" - ] - } - ], - "onPageComplete": "In the next step we'll look at how to `sort` data" - }, - { - "title": "Sort", - "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", - "tasks": [ - { - "description": "load `myBest`", - "tests": [ - "02/01" - ], - "actions": [ - "open('data/myBest.js')", - "set('const myBest = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n},{\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n},{\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:81,\n grade:\"B\"\n},{\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n},{\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n},{\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:82,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n}];\nexport default myBest;\n')" - ] - }, - { - "description": "`compareScore` should return 1 if the first score is less than the second", - "tests": [ - "02/02" - ], - "actions": [ - "open('02-sort.js')", - "set('import myBest from './data/myBest';\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" - ] - }, - { - "description": "`compareScore` should return -1 if the first score is more than the second", - "tests": [ - "02/03" - ], - "hints": [ - "set the second case to `b.score < a.score`" - ] - }, - { - "description": "`compareScore` should return 0 if the first score is the same as the second", - "tests": [ - "02/04" - ], - "hints": [ - "no case is necessary, use the `default` case" - ] - }, - { - "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", - "tests": [ - "02/05" - ], - "actions": [ - "insert('// use the compare function to sort myBest\nvar mySorted = myBest::>\n')" - ], - "hints": [ - "try using `myBest.sort()`" - ] - } - ], - "onPageComplete": "In the next step we'll look at changing data with `map`" - }, { "title": "Map", "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", @@ -188,7 +15,7 @@ ], "actions": [ "open('data/myCourses.js')", - "set('const myCourses = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n},{\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n},{\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:61,\n grade:\"D\"\n},{\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:81,\n grade:\"B\"\n},{\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:58,\n grade:\"F\"\n},{\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n},{\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:82,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n},{\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:65,\n grade:\"D\"\n}];\nexport default myCourses;\n')" + "set('const myCourses = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:61,\n grade:\"D\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:81,\n grade:\"B\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:58,\n grade:\"F\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:82,\n grade:\"B\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:65,\n grade:\"D\"\n}];\nexport default myCourses;\n')" ] }, { @@ -198,30 +25,33 @@ ], "actions": [ "open('03-map.js')", - "set('import myData from './data/myCourses';\n// Array.map(fn)\n\n// change any `student.grade`'s into an 'A'\nfunction changeGrade(course) {\n ::>\n}\n// example:\n// changeGrade({ grade: 'F' }) === { grade: 'A' };\n')" + "set('import myCourses from './data/myCourses';\n// Array.map(fn)\n\n/*\n change any `course.grade`'s into an 'A'\n\n example:\n changeGrade({ grade: 'F' }) === { grade: 'A' };\n*/\nfunction changeGrade(course) {\n ::>\n}\n\n')" ], "hints": [ - "give `changeGrade` a parameter, call it \"student\"", - "match for `student.grade`", - "match where `student.grade === 'A'`" + "give `changeGrade` a parameter, call it \"course\"", + "match for `course.grade`", + "match where `course.grade === 'A'`" ] }, { - "description": "Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result.", + "description": "Map over the `myCourses` with the `changeGrade` function. Set `myChanged` to the result.", "tests": [ "03/03" ], "actions": [ - "insert('// map over `myData` with the `changeGrade` function\nvar myChanged = myData.map(::>);\n')" + "insert('// map over `myCourses` and call `changeGrade` for each item\nconst myChanged = myCourses.map(::>);\n')" + ], + "hints": [ + "simply call `.map(changeGrade)`" ] }, { - "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myData` and instead increment each score by 12 points.", + "description": "Hold up. An A in \"Data Science\" class looks way to suspicious. Your parents might catch on to your cheating.\n\nLet's go back to `myCourses` and instead increment each score by 12 points.", "tests": [ "03/04" ], "actions": [ - "insert('\nfunction increaseScore(::>) {\n\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nvar mySlightlyChanged = myData;\n')" + "insert('\nfunction increaseScore(course) {\n ::>\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nconst mySlightlyChanged = myCourses;\n')" ], "hints": [ "give `increaseScore` a parameter, call it \"student\"", @@ -232,7 +62,7 @@ { "description": "Wait. Now you're getting 105 in \"Algorithm Design\" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious.", "tests": [ - "1/03/05" + "03/05" ], "hints": [ "use an if clause within `increaseScore`", @@ -245,7 +75,7 @@ "03/06" ], "actions": [ - "insert('\n// change `getGrade` to accept an object\n// and return an object\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nvar myFixed = mySlightlyChanged;\n')" + "insert('\n// change `getGrade` to accept a \"course\" instead of a \"score\"\n// and return that updated \"course\"\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nconst myFixed = mySlightlyChanged;\n')" ], "hints": [ "change `getGrade` to take a `student` param instead of `score`", @@ -259,7 +89,7 @@ "03/07" ], "actions": [ - "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nvar scoresAndGrades = myFixed::>\n')" + "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nconst scoresAndGrades = myFixed::>\n')" ], "hints": [ "use `map` to return only the \"score\" & \"grade\" fields", @@ -281,7 +111,7 @@ ], "actions": [ "open('data/myFixed.js')", - "set('const myFixed = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n},{\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n},{\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:85,\n grade:\"B\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:70,\n grade:\"C\"\n},{\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:94,\n grade:\"A\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n},{\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:77,\n grade:\"C\"\n}];\nexport default myFixed;\n')" + "set('const myFixed = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:85,\n grade:\"B\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:70,\n grade:\"C\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:77,\n grade:\"C\"\n}];\nexport default myFixed;\n')" ] }, { @@ -346,7 +176,7 @@ ], "actions": [ "open('data/students2.js')", - "set('const students=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"!f\",score:91,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Albert Gonzalez\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Brian Kernaghan\",score:35,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Grace Hopper\",score:36,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Hack Kerr\",score:85,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"James Gosling\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ken Thompson\",score:30,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Kevin Mitnick\",score:72,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Linus Torvalds\",score:34,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Rebecca Heineman\",score:71,grade:\"C\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Xiao Tian\",score:67,grade:\"D\"},{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",name:\"Ying Cracker\",score:57,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"in\",score:88,grade:\"B\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Albert Gonzalez\",score:37,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Brian Kernaghan\",score:76,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Donald Knuth\",score:34,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Grace Hopper\",score:74,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Hack Kerr\",score:86,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"James Gosling\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ken Thompson\",score:48,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Kevin Mitnick\",score:52,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Linus Torvalds\",score:90,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Rebecca Heineman\",score:73,grade:\"C\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Xiao Tian\",score:45,grade:\"F\"},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",name:\"Ying Cracker\",score:77,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"dt\",score:61,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Albert Gonzalez\",score:73,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Brian Kernaghan\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Donald Knuth\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Grace Hopper\",score:80,grade:\"B\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Hack Kerr\",score:92,grade:\"C\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"James Gosling\",score:97,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ken Thompson\",score:64,grade:\"D\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Linus Torvalds\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Niklaus Wirth\",score:93,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Rebecca Heineman\",score:58,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Xiao Tian\",score:36,grade:\"F\"},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",name:\"Ying Cracker\",score:73,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Donald Knuth\",score:44,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Albert Gonzalez\",score:74,grade:\"C\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Brian Kernaghan\",score:92,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"he\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Grace Hopper\",score:81,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Hack Kerr\",score:75,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"James Gosling\",score:95,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ken Thompson\",score:84,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Kevin Mitnick\",score:89,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Linus Torvalds\",score:57,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Niklaus Wirth\",score:88,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Rebecca Heineman\",score:93,grade:\"A\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Web Security\",instructor:\"Sue Denim\",name:\"Ying Cracker\",score:42,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"be\",score:73,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Albert Gonzalez\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Brian Kernaghan\",score:71,grade:\"C\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Donald Knuth\",score:94,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Grace Hopper\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Hack Kerr\",score:83,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"James Gosling\",score:99,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ken Thompson\",score:65,grade:\"D\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Kevin Mitnick\",score:47,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Linus Torvalds\",score:93,grade:\"A\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Niklaus Wirth\",score:50,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Rebecca Heineman\",score:33,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Xiao Tian\",score:87,grade:\"B\"},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",name:\"Ying Cracker\",score:60,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"st\",score:58,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Albert Gonzalez\",score:67,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Brian Kernaghan\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Donald Knuth\",score:36,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Grace Hopper\",score:66,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Hack Kerr\",score:96,grade:\"A\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"James Gosling\",score:83,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ken Thompson\",score:35,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Kevin Mitnick\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Linus Torvalds\",score:63,grade:\"D\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Niklaus Wirth\",score:75,grade:\"C\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Rebecca Heineman\",score:84,grade:\"B\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Xiao Tian\",score:49,grade:\"F\"},{title:\"Data Science\",instructor:\"Ford Fulkerson\",name:\"Ying Cracker\",score:96,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"re\",score:93,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Albert Gonzalez\",score:39,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Brian Kernaghan\",score:69,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Donald Knuth\",score:83,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Grace Hopper\",score:31,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Hack Kerr\",score:94,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"James Gosling\",score:35,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ken Thompson\",score:67,grade:\"D\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Kevin Mitnick\",score:81,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Linus Torvalds\",score:70,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Niklaus Wirth\",score:74,grade:\"C\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Rebecca Heineman\",score:92,grade:\"A\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Xiao Tian\",score:80,grade:\"B\"},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",name:\"Ying Cracker\",score:84,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"ve\",score:82,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Albert Gonzalez\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Brian Kernaghan\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Donald Knuth\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Grace Hopper\",score:42,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Hack Kerr\",score:87,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"James Gosling\",score:89,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ken Thompson\",score:86,grade:\"B\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Kevin Mitnick\",score:41,grade:\"F\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Linus Torvalds\",score:76,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Niklaus Wirth\",score:78,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Rebecca Heineman\",score:70,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Xiao Tian\",score:93,grade:\"A\"},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",name:\"Ying Cracker\",score:95,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"ng\",score:88,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Albert Gonzalez\",score:56,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Brian Kernaghan\",score:58,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Donald Knuth\",score:85,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Grace Hopper\",score:53,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Hack Kerr\",score:89,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"James Gosling\",score:42,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ken Thompson\",score:87,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Kevin Mitnick\",score:40,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Linus Torvalds\",score:91,grade:\"A\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Niklaus Wirth\",score:51,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Rebecca Heineman\",score:79,grade:\"C\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Xiao Tian\",score:84,grade:\"B\"},{title:\"Data Structures\",instructor:\"Brodal Q.\",name:\"Ying Cracker\",score:45,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"e!\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Albert Gonzalez\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Brian Kernaghan\",score:61,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Donald Knuth\",score:89,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Grace Hopper\",score:40,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Hack Kerr\",score:102,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"James Gosling\",score:39,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ken Thompson\",score:83,grade:\"B\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Kevin Mitnick\",score:37,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Linus Torvalds\",score:65,grade:\"D\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Niklaus Wirth\",score:36,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Rebecca Heineman\",score:32,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Xiao Tian\",score:52,grade:\"F\"},{title:\"Networks\",instructor:\"Van Emde Boas\",name:\"Ying Cracker\",score:62,grade:\"D\"}];\nexport default students;\n')" + "set('const students = [{\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"!f\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Albert Gonzalez\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Brian Kernaghan\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Danielle Bunten Berry\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Grace Hopper\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Hack Kerr\",\n score: 85,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"James Gosling\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ken Thompson\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Kevin Mitnick\",\n score: 72,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Linus Torvalds\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Rebecca Heineman\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Tim Berners-Lee\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Xiao Tian\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ying Cracker\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"in\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Albert Gonzalez\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Brian Kernaghan\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Danielle Bunten Berry\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Donald Knuth\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Grace Hopper\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Hack Kerr\",\n score: 86,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"James Gosling\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ken Thompson\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Kevin Mitnick\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Linus Torvalds\",\n score: 90,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Rebecca Heineman\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Tim Berners-Lee\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Xiao Tian\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ying Cracker\",\n score: 77,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"dt\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Albert Gonzalez\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Brian Kernaghan\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Danielle Bunten Berry\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Donald Knuth\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Grace Hopper\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Hack Kerr\",\n score: 92,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"James Gosling\",\n score: 97,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ken Thompson\",\n score: 64,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Linus Torvalds\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Niklaus Wirth\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Rebecca Heineman\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Tim Berners-Lee\",\n score: 98,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Xiao Tian\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ying Cracker\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Donald Knuth\",\n score: 44,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Albert Gonzalez\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Brian Kernaghan\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Danielle Bunten Berry\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"he\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Grace Hopper\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Hack Kerr\",\n score: 75,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"James Gosling\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ken Thompson\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Kevin Mitnick\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Linus Torvalds\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Niklaus Wirth\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Rebecca Heineman\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Tim Berners-Lee\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ying Cracker\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"be\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Albert Gonzalez\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Brian Kernaghan\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Danielle Bunten Berry\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Grace Hopper\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Hack Kerr\",\n score: 83,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"James Gosling\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ken Thompson\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Linus Torvalds\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Niklaus Wirth\",\n score: 50,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Rebecca Heineman\",\n score: 33,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Tim Berners-Lee\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ying Cracker\",\n score: 60,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"st\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Albert Gonzalez\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Brian Kernaghan\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Danielle Bunten Berry\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Donald Knuth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Grace Hopper\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Hack Kerr\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"James Gosling\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ken Thompson\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Kevin Mitnick\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Linus Torvalds\",\n score: 63,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Rebecca Heineman\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Tim Berners-Lee\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Xiao Tian\",\n score: 49,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ying Cracker\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"re\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Albert Gonzalez\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Brian Kernaghan\",\n score: 69,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Danielle Bunten Berry\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Donald Knuth\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Grace Hopper\",\n score: 31,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Hack Kerr\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"James Gosling\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ken Thompson\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Kevin Mitnick\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Linus Torvalds\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Niklaus Wirth\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Rebecca Heineman\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Tim Berners-Lee\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Xiao Tian\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ying Cracker\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"ve\",\n score: 82,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Albert Gonzalez\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Brian Kernaghan\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Donald Knuth\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Grace Hopper\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Hack Kerr\",\n score: 87,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"James Gosling\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ken Thompson\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Kevin Mitnick\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Linus Torvalds\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Rebecca Heineman\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Tim Berners-Lee\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Xiao Tian\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ying Cracker\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"ng\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Albert Gonzalez\",\n score: 56,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Brian Kernaghan\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Donald Knuth\",\n score: 85,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Grace Hopper\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Hack Kerr\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"James Gosling\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ken Thompson\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Kevin Mitnick\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Linus Torvalds\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Niklaus Wirth\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Rebecca Heineman\",\n score: 79,\n grade: \"C\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Tim Berners-Lee\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Xiao Tian\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ying Cracker\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"e!\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Albert Gonzalez\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Brian Kernaghan\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Danielle Bunten Berry\",\n score: 59,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Donald Knuth\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Grace Hopper\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Hack Kerr\",\n score: 102,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"James Gosling\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ken Thompson\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Kevin Mitnick\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Linus Torvalds\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Niklaus Wirth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Rebecca Heineman\",\n score: 32,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Tim Berners-Lee\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Xiao Tian\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ying Cracker\",\n score: 62,\n grade: \"D\"\n}];\nexport default students;\n')" ] }, { @@ -428,7 +258,7 @@ ], "actions": [ "open('data/courses2.js')", - "set('const courses=[{title:\"Relational Databases\",instructor:\"Sean Quentin Lewis\",students:[{name:\"!f\",score:61,grade:\"D\"},{name:\"Albert Gonzalez\",score:35,grade:\"F\"},{name:\"Brian Kernaghan\",score:35,grade:\"F\"},{name:\"Danielle Bunten Berry\",score:78,grade:\"C\"},{name:\"Donald Knuth\",score:94,grade:\"A\"},{name:\"Grace Hopper\",score:36,grade:\"F\"},{name:\"Hack Kerr\",score:85,grade:\"F\"},{name:\"James Gosling\",score:30,grade:\"F\"},{name:\"Ken Thompson\",score:30,grade:\"F\"},{name:\"Kevin Mitnick\",score:72,grade:\"C\"},{name:\"Linus Torvalds\",score:34,grade:\"F\"},{name:\"Niklaus Wirth\",score:75,grade:\"C\"},{name:\"Rebecca Heineman\",score:71,grade:\"C\"},{name:\"Tim Berners-Lee\",score:54,grade:\"F\"},{name:\"Xiao Tian\",score:67,grade:\"D\"},{name:\"Ying Cracker\",score:57,grade:\"F\"}]},{title:\"3D Computer Graphics\",instructor:\"G.L. Webb\",students:[{name:\"in\",score:58,grade:\"F\"},{name:\"Albert Gonzalez\",score:37,grade:\"F\"},{name:\"Brian Kernaghan\",score:76,grade:\"C\"},{name:\"Danielle Bunten Berry\",score:53,grade:\"F\"},{name:\"Donald Knuth\",score:34,grade:\"F\"},{name:\"Grace Hopper\",score:74,grade:\"C\"},{name:\"Hack Kerr\",score:86,grade:\"F\"},{name:\"James Gosling\",score:94,grade:\"A\"},{name:\"Ken Thompson\",score:48,grade:\"F\"},{name:\"Kevin Mitnick\",score:52,grade:\"F\"},{name:\"Linus Torvalds\",score:90,grade:\"A\"},{name:\"Niklaus Wirth\",score:78,grade:\"C\"},{name:\"Rebecca Heineman\",score:73,grade:\"C\"},{name:\"Tim Berners-Lee\",score:94,grade:\"A\"},{name:\"Xiao Tian\",score:45,grade:\"F\"},{name:\"Ying Cracker\",score:77,grade:\"C\"}]},{title:\"Front End Web Development\",instructor:\"Moe Zaick\",students:[{name:\"dt\",score:31,grade:\"F\"},{name:\"Albert Gonzalez\",score:73,grade:\"C\"},{name:\"Brian Kernaghan\",score:47,grade:\"F\"},{name:\"Danielle Bunten Berry\",score:87,grade:\"B\"},{name:\"Donald Knuth\",score:80,grade:\"B\"},{name:\"Grace Hopper\",score:80,grade:\"B\"},{name:\"Hack Kerr\",score:92,grade:\"C\"},{name:\"James Gosling\",score:97,grade:\"A\"},{name:\"Ken Thompson\",score:64,grade:\"D\"},{name:\"Kevin Mitnick\",score:47,grade:\"F\"},{name:\"Linus Torvalds\",score:58,grade:\"F\"},{name:\"Niklaus Wirth\",score:93,grade:\"A\"},{name:\"Rebecca Heineman\",score:58,grade:\"F\"},{name:\"Tim Berners-Lee\",score:98,grade:\"A\"},{name:\"Xiao Tian\",score:36,grade:\"F\"},{name:\"Ying Cracker\",score:73,grade:\"C\"}]},{title:\"Web Security\",instructor:\"Sue Denim\",students:[{name:\"he\",score:51,grade:\"F\"},{name:\"Albert Gonzalez\",score:74,grade:\"C\"},{name:\"Brian Kernaghan\",score:92,grade:\"A\"},{name:\"Danielle Bunten Berry\",score:34,grade:\"F\"},{name:\"Donald Knuth\",score:44,grade:\"F\"},{name:\"Grace Hopper\",score:81,grade:\"B\"},{name:\"Hack Kerr\",score:75,grade:\"F\"},{name:\"James Gosling\",score:95,grade:\"A\"},{name:\"Ken Thompson\",score:84,grade:\"B\"},{name:\"Kevin Mitnick\",score:89,grade:\"B\"},{name:\"Linus Torvalds\",score:57,grade:\"F\"},{name:\"Niklaus Wirth\",score:88,grade:\"B\"},{name:\"Rebecca Heineman\",score:93,grade:\"A\"},{name:\"Tim Berners-Lee\",score:36,grade:\"F\"},{name:\"Xiao Tian\",score:87,grade:\"B\"},{name:\"Ying Cracker\",score:42,grade:\"F\"}]},{title:\"Javascript Fundamentals\",instructor:\"Jay Kweerie\",students:[{name:\"be\",score:43,grade:\"F\"},{name:\"Albert Gonzalez\",score:94,grade:\"A\"},{name:\"Brian Kernaghan\",score:71,grade:\"C\"},{name:\"Danielle Bunten Berry\",score:66,grade:\"D\"},{name:\"Donald Knuth\",score:94,grade:\"A\"},{name:\"Grace Hopper\",score:99,grade:\"A\"},{name:\"Hack Kerr\",score:83,grade:\"F\"},{name:\"James Gosling\",score:99,grade:\"A\"},{name:\"Ken Thompson\",score:65,grade:\"D\"},{name:\"Kevin Mitnick\",score:47,grade:\"F\"},{name:\"Linus Torvalds\",score:93,grade:\"A\"},{name:\"Niklaus Wirth\",score:50,grade:\"F\"},{name:\"Rebecca Heineman\",score:33,grade:\"F\"},{name:\"Tim Berners-Lee\",score:51,grade:\"F\"},{name:\"Xiao Tian\",score:87,grade:\"B\"},{name:\"Ying Cracker\",score:60,grade:\"D\"}]},{title:\"Data Science\",instructor:\"Ford Fulkerson\",students:[{name:\"st\",score:28,grade:\"F\"},{name:\"Albert Gonzalez\",score:67,grade:\"D\"},{name:\"Brian Kernaghan\",score:66,grade:\"D\"},{name:\"Danielle Bunten Berry\",score:36,grade:\"F\"},{name:\"Donald Knuth\",score:36,grade:\"F\"},{name:\"Grace Hopper\",score:66,grade:\"D\"},{name:\"Hack Kerr\",score:96,grade:\"A\"},{name:\"James Gosling\",score:83,grade:\"B\"},{name:\"Ken Thompson\",score:35,grade:\"F\"},{name:\"Kevin Mitnick\",score:75,grade:\"C\"},{name:\"Linus Torvalds\",score:63,grade:\"D\"},{name:\"Niklaus Wirth\",score:75,grade:\"C\"},{name:\"Rebecca Heineman\",score:84,grade:\"B\"},{name:\"Tim Berners-Lee\",score:41,grade:\"F\"},{name:\"Xiao Tian\",score:49,grade:\"F\"},{name:\"Ying Cracker\",score:96,grade:\"A\"}]},{title:\"Algorithm Design\",instructor:\"Gale Shapely\",students:[{name:\"re\",score:63,grade:\"D\"},{name:\"Albert Gonzalez\",score:39,grade:\"F\"},{name:\"Brian Kernaghan\",score:69,grade:\"D\"},{name:\"Danielle Bunten Berry\",score:54,grade:\"F\"},{name:\"Donald Knuth\",score:83,grade:\"B\"},{name:\"Grace Hopper\",score:31,grade:\"F\"},{name:\"Hack Kerr\",score:94,grade:\"A\"},{name:\"James Gosling\",score:35,grade:\"F\"},{name:\"Ken Thompson\",score:67,grade:\"D\"},{name:\"Kevin Mitnick\",score:81,grade:\"B\"},{name:\"Linus Torvalds\",score:70,grade:\"C\"},{name:\"Niklaus Wirth\",score:74,grade:\"C\"},{name:\"Rebecca Heineman\",score:92,grade:\"A\"},{name:\"Tim Berners-Lee\",score:48,grade:\"F\"},{name:\"Xiao Tian\",score:80,grade:\"B\"},{name:\"Ying Cracker\",score:84,grade:\"B\"}]},{title:\"Data Abstraction\",instructor:\"Aster Ricks\",students:[{name:\"ve\",score:52,grade:\"F\"},{name:\"Albert Gonzalez\",score:70,grade:\"C\"},{name:\"Brian Kernaghan\",score:89,grade:\"B\"},{name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{name:\"Donald Knuth\",score:86,grade:\"B\"},{name:\"Grace Hopper\",score:42,grade:\"F\"},{name:\"Hack Kerr\",score:87,grade:\"F\"},{name:\"James Gosling\",score:89,grade:\"B\"},{name:\"Ken Thompson\",score:86,grade:\"B\"},{name:\"Kevin Mitnick\",score:41,grade:\"F\"},{name:\"Linus Torvalds\",score:76,grade:\"C\"},{name:\"Niklaus Wirth\",score:78,grade:\"C\"},{name:\"Rebecca Heineman\",score:70,grade:\"C\"},{name:\"Tim Berners-Lee\",score:74,grade:\"C\"},{name:\"Xiao Tian\",score:93,grade:\"A\"},{name:\"Ying Cracker\",score:95,grade:\"A\"}]},{title:\"Data Structures\",instructor:\"Brodal Q.\",students:[{name:\"ng\",score:58,grade:\"F\"},{name:\"Albert Gonzalez\",score:56,grade:\"F\"},{name:\"Brian Kernaghan\",score:58,grade:\"F\"},{name:\"Danielle Bunten Berry\",score:38,grade:\"F\"},{name:\"Donald Knuth\",score:85,grade:\"B\"},{name:\"Grace Hopper\",score:53,grade:\"F\"},{name:\"Hack Kerr\",score:89,grade:\"B\"},{name:\"James Gosling\",score:42,grade:\"F\"},{name:\"Ken Thompson\",score:87,grade:\"B\"},{name:\"Kevin Mitnick\",score:40,grade:\"F\"},{name:\"Linus Torvalds\",score:91,grade:\"A\"},{name:\"Niklaus Wirth\",score:51,grade:\"F\"},{name:\"Rebecca Heineman\",score:79,grade:\"C\"},{name:\"Tim Berners-Lee\",score:37,grade:\"F\"},{name:\"Xiao Tian\",score:84,grade:\"B\"},{name:\"Ying Cracker\",score:45,grade:\"F\"}]},{title:\"Networks\",instructor:\"Van Emde Boas\",students:[{name:\"e!\",score:35,grade:\"F\"},{name:\"Albert Gonzalez\",score:52,grade:\"F\"},{name:\"Brian Kernaghan\",score:61,grade:\"D\"},{name:\"Danielle Bunten Berry\",score:59,grade:\"F\"},{name:\"Donald Knuth\",score:89,grade:\"B\"},{name:\"Grace Hopper\",score:40,grade:\"F\"},{name:\"Hack Kerr\",score:102,grade:\"F\"},{name:\"James Gosling\",score:39,grade:\"F\"},{name:\"Ken Thompson\",score:83,grade:\"B\"},{name:\"Kevin Mitnick\",score:37,grade:\"F\"},{name:\"Linus Torvalds\",score:65,grade:\"D\"},{name:\"Niklaus Wirth\",score:36,grade:\"F\"},{name:\"Rebecca Heineman\",score:32,grade:\"F\"},{name:\"Tim Berners-Lee\",score:70,grade:\"C\"},{name:\"Xiao Tian\",score:52,grade:\"F\"},{name:\"Ying Cracker\",score:62,grade:\"D\"}]}];\nexport default courses;\n')" + "set('const courses = [{\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tstudents: [{\n\t\tname: \"!f\",\n\t\tscore: 61,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 78,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 85,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 30,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 30,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 72,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 34,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 75,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 71,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 54,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 67,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 57,\n\t\tgrade: \"F\"\n\t}]\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tstudents: [{\n\t\tname: \"in\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 37,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 76,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 53,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 34,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 86,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 48,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 90,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 78,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 73,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 45,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 77,\n\t\tgrade: \"C\"\n\t}]\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tstudents: [{\n\t\tname: \"dt\",\n\t\tscore: 31,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 73,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 47,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 80,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 80,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 92,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 97,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 64,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 47,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 98,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 73,\n\t\tgrade: \"C\"\n\t}]\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tstudents: [{\n\t\tname: \"he\",\n\t\tscore: 51,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 92,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 34,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 44,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 81,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 75,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 95,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 57,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 88,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 42,\n\t\tgrade: \"F\"\n\t}]\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tstudents: [{\n\t\tname: \"be\",\n\t\tscore: 43,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 71,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 66,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 99,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 83,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 99,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 65,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 47,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 50,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 33,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 51,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 60,\n\t\tgrade: \"D\"\n\t}]\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tstudents: [{\n\t\tname: \"st\",\n\t\tscore: 28,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 67,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 66,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 66,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 96,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 83,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 75,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 63,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 75,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 41,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 49,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 96,\n\t\tgrade: \"A\"\n\t}]\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tstudents: [{\n\t\tname: \"re\",\n\t\tscore: 63,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 39,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 69,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 54,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 83,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 31,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 67,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 81,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 92,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 48,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 80,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}]\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tstudents: [{\n\t\tname: \"ve\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 38,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 86,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 42,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 87,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 86,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 41,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 76,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 78,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 95,\n\t\tgrade: \"A\"\n\t}]\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tstudents: [{\n\t\tname: \"ng\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 56,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 38,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 85,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 53,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 42,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 40,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 91,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 51,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 79,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 37,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 45,\n\t\tgrade: \"F\"\n\t}]\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tstudents: [{\n\t\tname: \"e!\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 61,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 59,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 40,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 102,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 39,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 83,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 37,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 65,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 32,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 62,\n\t\tgrade: \"D\"\n\t}]\n}];\nexport default courses;\n')" ] }, { diff --git a/tutorial/00/02.js b/tutorial/00/02.js index 541c85a..4adf979 100644 --- a/tutorial/00/02.js +++ b/tutorial/00/02.js @@ -1,6 +1,6 @@ const setup = require('BASE/00-setup.js'); -describe('02 first', () => { +describe('02 const first', () => { // __get__ grabs global first const first = setup.__get__('first'); diff --git a/tutorial/00/03.js b/tutorial/00/03.js index d952be8..29a0b9b 100644 --- a/tutorial/00/03.js +++ b/tutorial/00/03.js @@ -1,4 +1,4 @@ -describe('03 myName', () => { +describe('03 const myName', () => { // __get__ grabs global myName const myName = setup.__get__('myName'); diff --git a/tutorial/01/01.js b/tutorial/01/01.js index 5c301cd..6075367 100644 --- a/tutorial/01/01.js +++ b/tutorial/01/01.js @@ -7,7 +7,7 @@ describe('01 function isAda', () => { const isAda = filter.__get__('isAda'); it('doesn\'t exist', () => { - expect(isAda).to.not.be.undefined; + expect(isAda).to.be.defined; }); it('isn\'t a Function', () => { diff --git a/tutorial/01/02.js b/tutorial/01/02.js index 5aeff43..3661925 100644 --- a/tutorial/01/02.js +++ b/tutorial/01/02.js @@ -1,9 +1,9 @@ -describe('02 var myData', () => { +describe('02 const myData', () => { const myData = filter.__get__('myData'); it('doesn\'t exist', () => { - expect(myData).to.not.be.undefined; + expect(myData).to.be.defined; }); it('doesn\'t output an array', () => { diff --git a/tutorial/01/03.js b/tutorial/01/03.js index 7074539..80d4c00 100644 --- a/tutorial/01/03.js +++ b/tutorial/01/03.js @@ -3,7 +3,7 @@ describe('03 function isGoodGrade', () => { const isGoodGrade = filter.__get__('isGoodGrade'); it('doesn\'t exist', () => { - expect(isGoodGrade).to.not.be.undefined; + expect(isGoodGrade).to.be.defined; }); it('isn\'t a Function', () => { diff --git a/tutorial/01/04.js b/tutorial/01/04.js index 71eb5e7..e70171b 100644 --- a/tutorial/01/04.js +++ b/tutorial/01/04.js @@ -1,9 +1,9 @@ -describe('04 var myBest', () => { +describe('04 const myBest', () => { const myBest = filter.__get__('myBest'); it('doesn\'t exist', () => { - expect(myBest).to.not.be.undefined; + expect(myBest).to.be.defined; }); it('doesn\'t output an array', () => { diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index 25ee176..7f2323e 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -17,7 +17,7 @@ function isA(x) { Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). ``` -var list = ['a', 'b']; +const list = ['a', 'b']; list.filter(isA); // if isA(list[0]), add to output array @@ -33,7 +33,7 @@ function isB(x) { return x.item === 'b' } -var list = [{item: 'a'}, {item: 'b'}]; +const list = [{item: 'a'}, {item: 'b'}]; list.filter(isB); //> [{item: 'b'}] ``` @@ -70,12 +70,12 @@ function isAda(student) { @hint('Check if `student.name` matches "Ada Lovelace"') @hint('Use `===` to check equality') -+ Set `var myData` to filter with the `isAda` function. ++ Set `const myData` to filter with the `isAda` function. @test('01/02') @action(insert( ``` // run the function name in filter -var myData = students.filter(::>); +const myData = students.filter(::>); ``` )) @hint('Add a function to the `filter` call: `Array.filter(function() {})`') @@ -97,13 +97,13 @@ function isGoodGrade(student) { @hint('use `!==` to check non-equality') @hint('Match for both: `student.grade !== "D" && student.grade !== "F"`') -+ Set `var myBest` to your scores, excluding any grades that are "D" or "F". ++ Set `const myBest` to your scores, excluding any grades that are "D" or "F". @test('01/04') @action(insert( ``` // filter out "D"'s and "F"'s here -var myBest = myData.filter(::>); +const myBest = myData.filter(::>); ``` )) diff --git a/tutorial/02/02.js b/tutorial/02/02.js index c638bb8..a7f9b89 100644 --- a/tutorial/02/02.js +++ b/tutorial/02/02.js @@ -4,7 +4,7 @@ const compareScore = sort.__get__('compareScore'); describe('02 function compareScore', () => { it('doesn\'t exist', () => { - expect(compareScore).to.not.be.undefined; + expect(compareScore).to.be.defined; }); it('isn\'t a Function', () => { diff --git a/tutorial/02/05.js b/tutorial/02/05.js index 9aa22b1..0ca0893 100644 --- a/tutorial/02/05.js +++ b/tutorial/02/05.js @@ -1,9 +1,9 @@ -describe('05 var mySorted', () => { +describe('05 const mySorted', () => { const mySorted = sort.__get__('mySorted'); it('doesn\'t exist', () => { - expect(mySorted).to.not.be.undefined; + expect(mySorted).to.be.defined; }); it('doesn\'t output an array', () => { diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index 103c912..45b6a51 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -120,7 +120,7 @@ function compareScore(a, b) { @action(insert( ``` // use the compare function to sort myBest -var mySorted = myBest::> +const mySorted = myBest::> ``` )) @hint('try using `myBest.sort()`') diff --git a/tutorial/03/02.js b/tutorial/03/02.js index ff20cc9..2050d67 100644 --- a/tutorial/03/02.js +++ b/tutorial/03/02.js @@ -5,7 +5,7 @@ describe('02 function changeGrade', () => { const changeGrade = map.__get__('changeGrade'); it('doesn\'t exist', () => { - expect(changeGrade).to.not.be.undefined; + expect(changeGrade).to.be.defined; }); it('isn\'t a function', () => { diff --git a/tutorial/03/03.js b/tutorial/03/03.js index ef2331e..9a6ccd6 100644 --- a/tutorial/03/03.js +++ b/tutorial/03/03.js @@ -1,9 +1,9 @@ -describe('03 var myChanged', () => { +describe('03 const myChanged', () => { const myChanged = map.__get__('myChanged'); it('doesn\'t exist', () => { - expect(myChanged).to.not.be.undefined; + expect(myChanged).to.be.defined; }); it('isn\'t an array', () => { diff --git a/tutorial/03/04.js b/tutorial/03/04.js index b7c74c3..2b45dc1 100644 --- a/tutorial/03/04.js +++ b/tutorial/03/04.js @@ -3,7 +3,7 @@ describe('04 function increaseScore', () => { const increaseScore = map.__get__('increaseScore'); it('doesn\'t exist', () => { - expect(increaseScore).to.not.be.undefined; + expect(increaseScore).to.be.defined; }); it('should be a function', () => { diff --git a/tutorial/03/05.js b/tutorial/03/05.js index b465dd1..8ffa5fe 100644 --- a/tutorial/03/05.js +++ b/tutorial/03/05.js @@ -3,7 +3,7 @@ describe('05 function increaseScore', () => { const increaseScore = map.__get__('increaseScore'); it('doesn\'t exist', () => { - expect(increaseScore).to.not.be.undefined; + expect(increaseScore).to.be.defined; }); it('should be a function', () => { diff --git a/tutorial/03/06.js b/tutorial/03/06.js index d23baf9..4741fad 100644 --- a/tutorial/03/06.js +++ b/tutorial/03/06.js @@ -3,7 +3,7 @@ describe('06 function getGrade', () => { const getGrade = map.__get__('getGrade'); it('doesn\'t exist', () => { - expect(getGrade).to.not.be.undefined; + expect(getGrade).to.be.defined; }); it('should be a function', () => { @@ -17,24 +17,12 @@ describe('06 function getGrade', () => { }); -describe('05 var myFixed', () => { +describe('05 const mySlightlyChanged', () => { - const myFixed = map.__get__('myFixed'); - - it('doesn\'t exist', () => { - expect(myFixed).to.not.be.undefined; - }); - - it('isn\'t an array', () => { - expect(myFixed).to.be.an('array'); - }); - - it('doesn\'t have 10 items', () => { - expect(myFixed).to.have.length(10); - }); + const mySlightlyChanged = map.__get__('mySlightlyChanged'); it('doesn\'t update grades correctly', () => { - expect(myFixed.map((x) => { + expect(mySlightlyChanged.map((x) => { return x.grade; })).to.deep.equal(['A', 'A', 'C', 'A', 'B', 'C', 'A', 'A', 'A', 'C']); }); diff --git a/tutorial/03/07.js b/tutorial/03/07.js index fb17110..2b4d0df 100644 --- a/tutorial/03/07.js +++ b/tutorial/03/07.js @@ -1,4 +1,4 @@ -describe('07 var scoresAndGrades', () => { +describe('07 const scoresAndGrades', () => { const scoresAndGrades = map.__get__('scoresAndGrades'); diff --git a/tutorial/03/map.md b/tutorial/03/map.md index ebf820e..d9af6b6 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -131,53 +131,58 @@ export default myCourses; @action(open('03-map.js')) @action(set( ``` -import myData from './data/myCourses'; +import myCourses from './data/myCourses'; // Array.map(fn) -// change any `student.grade`'s into an 'A' +/* + change any `course.grade`'s into an 'A' + + example: + changeGrade({ grade: 'F' }) === { grade: 'A' }; +*/ function changeGrade(course) { ::> } -// example: -// changeGrade({ grade: 'F' }) === { grade: 'A' }; + ``` )) -@hint('give `changeGrade` a parameter, call it "student"') -@hint('match for `student.grade`') -@hint('match where `student.grade === 'A'`') +@hint('give `changeGrade` a parameter, call it "course"') +@hint('set `course.grade` to "A"') +@hint('return the changed course') -+ Map over the `myData` with the `changeGrade` function. Set `myChanged` to the result. ++ Map over the `myCourses` with the `changeGrade` function. Set `myChanged` to the result. @test('03/03') @action(insert( ``` -// map over `myData` with the `changeGrade` function -var myChanged = myData.map(::>); +// map over `myCourses` and call `changeGrade` for each item +const myChanged = myCourses.map(::>); ``` )) +@hint('simply call `.map(changeGrade)`') + Hold up. An A in "Data Science" class looks way to suspicious. Your parents might catch on to your cheating. -Let's go back to `myData` and instead increment each score by 12 points. +Let's go back to `myCourses` and instead increment each score by 12 points. @test('03/04') @action(insert( ``` -function increaseScore(::>) { - +function increaseScore(course) { + ::> } // map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12 -var mySlightlyChanged = myData; +const mySlightlyChanged = myCourses; ``` )) -@hint('give `increaseScore` a parameter, call it "student"') -@hint('it should increase `student.score`') -@hint('return `student`') +@hint('give `increaseScore` a parameter, call it "course"') +@hint('it should increase `course.score`') +@hint('return `course`') + Wait. Now you're getting 105 in "Algorithm Design" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious. -@test('1/03/05') +@test('03/05') @hint('use an if clause within `increaseScore`') @hint('try `if (student.score >= 95) { student.score = 95 }`') @@ -186,8 +191,8 @@ var mySlightlyChanged = myData; @action(insert( ``` -// change `getGrade` to accept an object -// and return an object +// change `getGrade` to accept a "course" instead of a "score" +// and return that updated "course" function getGrade(score) { switch (true) { case (score >= 90): @@ -204,12 +209,12 @@ function getGrade(score) { } // map `myFixed` to update grades to the new scores -var myFixed = mySlightlyChanged; +const myFixed = mySlightlyChanged; ``` )) -@hint('change `getGrade` to take a `student` param instead of `score`') -@hint('change the grade and return the `student`') -@hint('set `student.grade = "A"` and return `student`') +@hint('change `getGrade` to take a `course` param instead of `score`') +@hint('change the grade and return the `course`') +@hint('set `course.grade = "A"` and return `course`') + Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only. @test('03/07') @@ -218,7 +223,7 @@ var myFixed = mySlightlyChanged; // set `scoresAndGrades` to an array of scores and grades // it should return an array of objects like this: {score: 75, grade: 'C'} -var scoresAndGrades = myFixed::> +const scoresAndGrades = myFixed::> ``` )) @hint('use `map` to return only the "score" & "grade" fields') diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index d53ab9c..d853d5b 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -17,7 +17,7 @@ Know it or not, you're probably already used to "imperative" programming. Imperative code tells the computer what to do, step by step. ```js -var x = 1; // make a variable +let x = 1; // make a variable x = x + 1; // add one x = x + 1; // add another console.log(x); @@ -46,7 +46,7 @@ A function is "pure" if it doesn't change anything outside of its scope. Pure fu On the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time. ```js -var y = 1; +let y = 1; // impure function function increment(x) { y += x; diff --git a/tutorial/05/02.js b/tutorial/05/02.js index 5eb8c04..e6cbc69 100644 --- a/tutorial/05/02.js +++ b/tutorial/05/02.js @@ -1,6 +1,6 @@ const find = require('BASE/05-find.js'); -describe('02 var myClass', () => { +describe('02 const myClass', () => { const students = find.__get__('students'); const myClass = find.__get__('myClass'); diff --git a/tutorial/05/03.js b/tutorial/05/03.js index 8253b9c..525d0c1 100644 --- a/tutorial/05/03.js +++ b/tutorial/05/03.js @@ -10,7 +10,7 @@ describe('03 function notInList', () => { }); -describe('03 var unknownStudent', () => { +describe('03 const unknownStudent', () => { const unknownStudent = find.__get__('unknownStudent'); diff --git a/tutorial/05/04.js b/tutorial/05/04.js index 10adf0b..cbb1891 100644 --- a/tutorial/05/04.js +++ b/tutorial/05/04.js @@ -1,4 +1,4 @@ -describe('04 var unknownStudentList', () => { +describe('04 const unknownStudentList', () => { const unknownStudentList = find.__get__('unknownStudentList'); diff --git a/tutorial/05/05.js b/tutorial/05/05.js index 9300b10..774fc3e 100644 --- a/tutorial/05/05.js +++ b/tutorial/05/05.js @@ -1,4 +1,4 @@ -describe('05 var unknownStudentNames', () => { +describe('05 const unknownStudentNames', () => { const unknownStudentNames = find.__get__('unknownStudentNames'); diff --git a/tutorial/05/06.js b/tutorial/05/06.js index f615675..d34b39e 100644 --- a/tutorial/05/06.js +++ b/tutorial/05/06.js @@ -1,4 +1,4 @@ -describe('06 var decodedName', () => { +describe('06 const decodedName', () => { const decodedName = find.__get__('decodedName'); diff --git a/tutorial/05/find.md b/tutorial/05/find.md index b014a1d..a87d96e 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -8,7 +8,7 @@ You quickly put together a list of other students in class. If someone changed y `find` works similar to `filter`, but returns only the first match. ``` -var data = [1, 2, 3, 4, 5, 6]; +const data = [1, 2, 3, 4, 5, 6]; function isEven(num) { return num % 2 === 0; @@ -1004,7 +1004,7 @@ import students from './data/students2'; // Array.find(fn) // filter for the student title matches "Web Security" -var myClass = students.filter(::>); +const myClass = students.filter(::>); ``` )) @hint('create a `filter` function') @@ -1015,7 +1015,7 @@ var myClass = students.filter(::>); @action(insert( ``` -var otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berry", "Donald Knuth", "Grace Hopper", "Hack Kerr", "James Gosling", "Ken Thompson", "Kevin Mitnick", "Linus Torvalds", "Niklaus Wirth", "Rebecca Heineman", "Tim Berners-Lee", "Xiao Tian", "Ying Cracker"]; +const otherStudents = ["Albert Gonzalez", "Brian Kernaghan", "Danielle Bunten Berry", "Donald Knuth", "Grace Hopper", "Hack Kerr", "James Gosling", "Ken Thompson", "Kevin Mitnick", "Linus Torvalds", "Niklaus Wirth", "Rebecca Heineman", "Tim Berners-Lee", "Xiao Tian", "Ying Cracker"]; ``` )) @@ -1028,7 +1028,7 @@ function notInList(::>) { } // find using `notInList` -var unknownStudent = myClass.find(); +const unknownStudent = myClass.find(); ``` )) @hint('use `indexOf` to find what doesn't match') @@ -1041,7 +1041,7 @@ var unknownStudent = myClass.find(); ``` // filter using `notInList` -var unknownStudentList = students.filter(::>); +const unknownStudentList = students.filter(::>); ``` )) @hint('consider reusing a function') @@ -1052,7 +1052,7 @@ var unknownStudentList = students.filter(::>); ``` // list only student names -var unknownStudentNames = unknownStudentList.map(::>); +const unknownStudentNames = unknownStudentList.map(::>); ``` )) @hint('use `map` to return only the `student.name`') @@ -1063,7 +1063,7 @@ var unknownStudentNames = unknownStudentList.map(::>); ``` // use `.join('')` to join the array of strings -var decodedName = unknownStudentNames::>; +const decodedName = unknownStudentNames::>; console.log(decodedName); ``` )) diff --git a/tutorial/06/02.js b/tutorial/06/02.js index 8d3b2f3..709ffc6 100644 --- a/tutorial/06/02.js +++ b/tutorial/06/02.js @@ -1,6 +1,6 @@ const concat = require('BASE/06-concat.js'); -describe('02 var flattenedArray', () => { +describe('02 const flattenedArray', () => { const flattenedArray = concat.__get__('flattenedArray'); diff --git a/tutorial/06/03.js b/tutorial/06/03.js index d49a187..3f0e7fc 100644 --- a/tutorial/06/03.js +++ b/tutorial/06/03.js @@ -1,4 +1,4 @@ -describe('03 var doubleArray', () => { +describe('03 const doubleArray', () => { const doubleArray = concat.__get__('doubleArray'); diff --git a/tutorial/06/04.js b/tutorial/06/04.js index fc67a42..33b1391 100644 --- a/tutorial/06/04.js +++ b/tutorial/06/04.js @@ -1,4 +1,4 @@ -describe('04 var students', () => { +describe('04 const students', () => { const students = concat.__get__('students'); diff --git a/tutorial/06/05.js b/tutorial/06/05.js index d4b5a44..43b5331 100644 --- a/tutorial/06/05.js +++ b/tutorial/06/05.js @@ -1,4 +1,4 @@ -describe('05 var suspectData', () => { +describe('05 const suspectData', () => { const suspectData = concat.__get__('suspectData'); diff --git a/tutorial/06/06.js b/tutorial/06/06.js index 7475004..9d095b3 100644 --- a/tutorial/06/06.js +++ b/tutorial/06/06.js @@ -1,4 +1,4 @@ -describe('06 var newSuspects', () => { +describe('06 const newSuspects', () => { const newSuspects = concat.__get__('newSuspects'); @@ -16,7 +16,7 @@ describe('06 var newSuspects', () => { }); -describe('05 var suspectData', () => { +describe('05 const suspectData', () => { const suspectData = concat.__get__('suspectData'); diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index eb021a6..4b33d2d 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -63,7 +63,7 @@ Unfortunately, Javascript is missing a built in array method to concat multiple Let's look at an abstraction of what we need to do: ```js -var start = [{ +const start = [{ a: 1, c: [ { b: 1 } @@ -75,7 +75,7 @@ var start = [{ ] }]; -var middle = start.map(function(outer) { +const middle = start.map(function(outer) { return outer.c.map(function(inner) { return { a: outer.a, @@ -85,7 +85,7 @@ var middle = start.map(function(outer) { }); //> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ] -var end = pre.flatten(); +const end = pre.flatten(); //> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}] ``` @@ -804,10 +804,10 @@ Array.prototype.flatten = function() { @action(insert( ``` -var numberedList = [[1, 2], [3, 4]]; +const numberedList = [[1, 2], [3, 4]]; // use `flatten` on `numberedList` -var flattenedArray = numberedList::>; +const flattenedArray = numberedList::>; ``` )) @hint('call `.flatten()` on `numberedList`') @@ -827,7 +827,7 @@ Return the fields: // map over courses then // map over students inside of courses -var doubleArray = courses.map(function(course) { +const doubleArray = courses.map(function(course) { return course.students.map(function(student) { return { // fill in the fields @@ -850,7 +850,7 @@ var doubleArray = courses.map(function(course) { @action(insert( ``` // `flatten` doubleArray -var students = doubleArray::>; +const students = doubleArray::>; ``` )) @hint('call `.flatten()` on `doubleArray`') @@ -860,17 +860,17 @@ var students = doubleArray::>; @action(insert( ``` -var suspects = ["Hack Kerr"]; +const suspects = ["Hack Kerr"]; // filter to data matching `suspects` -var suspectData = students::>; +const suspectData = students::>; ``` )) + You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`. ```js -var newSuspects = ['Albert Gonzalez', 'Kevin Mitnick']; +const newSuspects = ['Albert Gonzalez', 'Kevin Mitnick']; ``` `concat` the `newSuspects` onto the `suspects` list. diff --git a/tutorial/07/01.js b/tutorial/07/01.js index c022f4a..61e61da 100644 --- a/tutorial/07/01.js +++ b/tutorial/07/01.js @@ -2,7 +2,7 @@ const expect = require('chai').expect; const reduce = require('BASE/07-reduce.js'); -describe('01 var total', () => { +describe('01 const total', () => { const total = reduce.__get__('total'); diff --git a/tutorial/07/02.js b/tutorial/07/02.js index 603af38..34994c6 100644 --- a/tutorial/07/02.js +++ b/tutorial/07/02.js @@ -1,4 +1,4 @@ -describe('02 var averages', () => { +describe('02 const averages', () => { const averages = reduce.__get__('averages'); diff --git a/tutorial/07/04.js b/tutorial/07/04.js index d6b3acd..1f26d52 100644 --- a/tutorial/07/04.js +++ b/tutorial/07/04.js @@ -1,4 +1,4 @@ -describe('04 var suspectScores', () => { +describe('04 const suspectScores', () => { it('should reduce to an array of suspect scores', () => { diff --git a/tutorial/07/05.js b/tutorial/07/05.js index 9230372..8676abd 100644 --- a/tutorial/07/05.js +++ b/tutorial/07/05.js @@ -1,4 +1,4 @@ -describe('05 var suspectStats', () => { +describe('05 const suspectStats', () => { it('should map over suspect data to find the score differences', () => { diff --git a/tutorial/07/06.js b/tutorial/07/06.js index e5f0a5f..2c10689 100644 --- a/tutorial/07/06.js +++ b/tutorial/07/06.js @@ -1,4 +1,4 @@ -describe('06 var likelySuspects', () => { +describe('06 const likelySuspects', () => { const likelySuspects = reduce.__get__('likelySuspects'); diff --git a/tutorial/07/07.js b/tutorial/07/07.js index 1ace883..a8ed991 100644 --- a/tutorial/07/07.js +++ b/tutorial/07/07.js @@ -1,4 +1,4 @@ -describe('07 var likelySuspects', () => { +describe('07 const likelySuspects', () => { it('should pass', () => { expect(true).to.be.true; diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index ba67750..7c35e38 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -20,7 +20,7 @@ function add(total, next) { return total + next } -var initialValue = 100; +const initialValue = 100; [1, 5, 10].reduce(add, initialValue); // initial value // add(100, 1) -> 101 @@ -56,14 +56,14 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp import courses from './data/courses2'; // Array.reduce(fn(a, b), initialValue) -var practice = [1, 1, 2, 3, 5, 8, 13, 21]; +const practice = [1, 1, 2, 3, 5, 8, 13, 21]; function add(a, b) { return a + b; } // total the numbers using a reduce function -var total = practice.reduce(::>); +const total = practice.reduce(::>); ``` )) @hint('with only numbers, the initialValue defaults to 0') @@ -76,8 +76,8 @@ var total = practice.reduce(::>); @action(insert( ``` -var averages = courses.map(function(course) { - var sum = course.students.reduce(function(total, student) { +const averages = courses.map(function(course) { + const sum = course.students.reduce(function(total, student) { ::> }); @@ -287,9 +287,9 @@ export default suspectData; ``` // [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...] -var suspectScores = suspectData.reduce(function(total, next) { +const suspectScores = suspectData.reduce(function(total, next) { // see if suspect name has a list yet - var index = total.findIndex(function(suspect) { + const index = total.findIndex(function(suspect) { return suspect.name === next.name; }); if (index < 0) { @@ -323,9 +323,9 @@ var suspectScores = suspectData.reduce(function(total, next) { @action(insert( ``` -var suspectStats = suspectScores.map(function(suspect) { +const suspectStats = suspectScores.map(function(suspect) { // calculate the total difference in scores from the averages - var difference = suspect.scores.reduce(::>); + const difference = suspect.scores.reduce(::>); return { name: suspect.name, @@ -352,7 +352,7 @@ function isCheater(suspect) { } // reduce down to a string of likely suspects -var likelySuspects = suspectStats.reduce(function(::>) {}, []); +const likelySuspects = suspectStats.reduce(function(::>) {}, []); ``` )) @hint('use `.join(', ')`') diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index 4447c97..ce81137 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -8,9 +8,9 @@ Keywords: javascript, functional Length: 1-2 hours -@import('00/setup') -@import('01/filter') -@import('02/sort') + + + @import('03/map') @import('04/forEach') @import('05/find') From bb1c1d40f922bae10daf1ab6e7e08c24fa53058a Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 9 Aug 2016 11:59:45 -0700 Subject: [PATCH 35/46] polish step 05 --- README.md | 134 +++++++++++- coderoad.json | 259 +++++++++++++++++++---- tutorial/03/02.js | 9 +- tutorial/03/04.js | 19 +- tutorial/03/05.js | 20 +- tutorial/03/06.js | 2 +- tutorial/03/map.md | 22 +- tutorial/05/01.js | 8 +- tutorial/05/02.js | 6 +- tutorial/05/04.js | 4 +- tutorial/05/{students2.js => courses.js} | 4 +- tutorial/05/find.md | 24 ++- tutorial/tutorial.md | 6 +- 13 files changed, 400 insertions(+), 117 deletions(-) rename tutorial/05/{students2.js => courses.js} (99%) diff --git a/README.md b/README.md index d09edc7..4a575ef 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,6 @@ Keywords: javascript, functional Length: 1-2 hours - - - @@ -32,6 +29,123 @@ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. L ## Outline +##### Start + +Understanding the Data Set + +Over this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like. + +```json +var students = [ + { + "title": "Relational Databases", + "instructor": "Sean Quentin Lewis", + "name": "Ada Lovelace", + "score": 91, + "grade": "A" + }, + ... +] +``` + +Here we have an array of "student" objects. To get the first item in the array, you can use the array index. Array indexes start at 0. + +```js +console.log( + 'first instructor', students[0].instructor +); +// first instructor Sean Quentin Lewis +``` + +##### Filter + +Array -> Array of items that match a condition + +You've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card. + +It would be great if you could `filter` the scores that your parents will see. + +`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below: + +``` +function isA(x) { + return x === 'a'; +} +``` + + +Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). + +``` +const list = ['a', 'b']; +list.filter(isA); + +// if isA(list[0]), add to output array +// if isA(list[1]), add to output array +// +//> ['a'] +``` + +If your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below. + +``` +function isB(x) { + return x.item === 'b' +} + +const list = [{item: 'a'}, {item: 'b'}]; +list.filter(isB); +//> [{item: 'b'}] +``` + +Where were we? Back to filtering our grades. + +There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: + +``` +console.log(students[0]); +//> { course: 'Web Security', +// instructor: 'Sue Denim', +// name: 'Rebecca Heineman', +// score: 93, +// grade: 'A' } +``` + +##### Sort + +Array -> sorted Array + +Your grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through. + +You can use the array method `sort` to arrange your data. Let's see how it works. + +```js +['c', 'b', 'a'].sort(); +//> ['a', 'b', 'c'] + +[3, 2, 1].sort(); +//> [1, 2, 3] +``` + +But what about sorting scores inside of an object? + +```js +[{a: 3}, {a: 1}, {a: 2}].sort(); +//> [{a: 3}, {a: 1}, {a: 2}] +``` + +That didn't work. Instead, you can write a custom `compareScore` function. + +A sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array: + + * -1 : sort to a lower index (front) + * 1 : sort to a higher index (back) + * 0 : stay the same + +Alright, now time to sort your best grades to the top. + +First you'll need to write a sort condition function called `compareScore`. + ##### Map Array -> run a function over each item -> Array @@ -111,7 +225,7 @@ Know it or not, you're probably already used to "imperative" programming. Imperative code tells the computer what to do, step by step. ```js -var x = 1; // make a variable +let x = 1; // make a variable x = x + 1; // add one x = x + 1; // add another console.log(x); @@ -140,7 +254,7 @@ A function is "pure" if it doesn't change anything outside of its scope. Pure fu On the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time. ```js -var y = 1; +let y = 1; // impure function function increment(x) { y += x; @@ -191,7 +305,7 @@ You quickly put together a list of other students in class. If someone changed y `find` works similar to `filter`, but returns only the first match. ``` -var data = [1, 2, 3, 4, 5, 6]; +const data = [1, 2, 3, 4, 5, 6]; function isEven(num) { return num % 2 === 0; @@ -274,7 +388,7 @@ Unfortunately, Javascript is missing a built in array method to concat multiple Let's look at an abstraction of what we need to do: ```js -var start = [{ +const start = [{ a: 1, c: [ { b: 1 } @@ -286,7 +400,7 @@ var start = [{ ] }]; -var middle = start.map(function(outer) { +const middle = start.map(function(outer) { return outer.c.map(function(inner) { return { a: outer.a, @@ -296,7 +410,7 @@ var middle = start.map(function(outer) { }); //> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ] -var end = pre.flatten(); +const end = pre.flatten(); //> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}] ``` @@ -329,7 +443,7 @@ function add(total, next) { return total + next } -var initialValue = 100; +const initialValue = 100; [1, 5, 10].reduce(add, initialValue); // initial value // add(100, 1) -> 101 diff --git a/coderoad.json b/coderoad.json index 62c7836..0b923fd 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,9 +1,182 @@ { "info": { "title": "Functional School", - "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n\n\n\n" + "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n" }, "pages": [ + { + "title": "Start", + "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", + "tasks": [ + { + "description": "Load the student data into \"students.js\"", + "tests": [ + "00/01" + ], + "actions": [ + "open('data/students.js')", + "set('const students = [{\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ada Lovelace\",\n\tscore: 91,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Albert Gonzalez\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Brian Kernaghan\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 78,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Donald Knuth\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Grace Hopper\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Hack Kerr\",\n\tscore: 85,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"James Gosling\",\n\tscore: 30,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ken Thompson\",\n\tscore: 30,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Kevin Mitnick\",\n\tscore: 72,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Linus Torvalds\",\n\tscore: 34,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Niklaus Wirth\",\n\tscore: 75,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Rebecca Heineman\",\n\tscore: 71,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 54,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Xiao Tian\",\n\tscore: 67,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ying Cracker\",\n\tscore: 57,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Albert Gonzalez\",\n\tscore: 37,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Brian Kernaghan\",\n\tscore: 76,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 53,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Donald Knuth\",\n\tscore: 34,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Grace Hopper\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Hack Kerr\",\n\tscore: 86,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"James Gosling\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ken Thompson\",\n\tscore: 48,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Kevin Mitnick\",\n\tscore: 52,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Linus Torvalds\",\n\tscore: 90,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Niklaus Wirth\",\n\tscore: 78,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Rebecca Heineman\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Xiao Tian\",\n\tscore: 45,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ying Cracker\",\n\tscore: 77,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Ada Lovelace\",\n\tscore: 61,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Albert Gonzalez\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Brian Kernaghan\",\n\tscore: 47,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Donald Knuth\",\n\tscore: 80,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Grace Hopper\",\n\tscore: 80,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Hack Kerr\",\n\tscore: 92,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"James Gosling\",\n\tscore: 97,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Ken Thompson\",\n\tscore: 64,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Kevin Mitnick\",\n\tscore: 47,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Linus Torvalds\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Niklaus Wirth\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Rebecca Heineman\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 98,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Xiao Tian\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Ying Cracker\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ada Lovelace\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Albert Gonzalez\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Brian Kernaghan\",\n\tscore: 92,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 34,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Donald Knuth\",\n\tscore: 44,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Grace Hopper\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Hack Kerr\",\n\tscore: 75,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"James Gosling\",\n\tscore: 95,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ken Thompson\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Kevin Mitnick\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Linus Torvalds\",\n\tscore: 57,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Niklaus Wirth\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Rebecca Heineman\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Xiao Tian\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ying Cracker\",\n\tscore: 42,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ada Lovelace\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Albert Gonzalez\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Brian Kernaghan\",\n\tscore: 71,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 66,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Donald Knuth\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Grace Hopper\",\n\tscore: 99,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Hack Kerr\",\n\tscore: 83,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"James Gosling\",\n\tscore: 99,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ken Thompson\",\n\tscore: 65,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Kevin Mitnick\",\n\tscore: 47,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Linus Torvalds\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Niklaus Wirth\",\n\tscore: 50,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Rebecca Heineman\",\n\tscore: 33,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 51,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Xiao Tian\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ying Cracker\",\n\tscore: 60,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Ada Lovelace\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Albert Gonzalez\",\n\tscore: 67,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Brian Kernaghan\",\n\tscore: 66,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Donald Knuth\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Grace Hopper\",\n\tscore: 66,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Hack Kerr\",\n\tscore: 96,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"James Gosling\",\n\tscore: 83,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Ken Thompson\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Kevin Mitnick\",\n\tscore: 75,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Linus Torvalds\",\n\tscore: 63,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Niklaus Wirth\",\n\tscore: 75,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Rebecca Heineman\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 41,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Xiao Tian\",\n\tscore: 49,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Ying Cracker\",\n\tscore: 96,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ada Lovelace\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Albert Gonzalez\",\n\tscore: 39,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Brian Kernaghan\",\n\tscore: 69,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 54,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Donald Knuth\",\n\tscore: 83,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Grace Hopper\",\n\tscore: 31,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Hack Kerr\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"James Gosling\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ken Thompson\",\n\tscore: 67,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Kevin Mitnick\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Linus Torvalds\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Niklaus Wirth\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Rebecca Heineman\",\n\tscore: 92,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 48,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Xiao Tian\",\n\tscore: 80,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ying Cracker\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ada Lovelace\",\n\tscore: 82,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Albert Gonzalez\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Brian Kernaghan\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 38,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Donald Knuth\",\n\tscore: 86,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Grace Hopper\",\n\tscore: 42,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Hack Kerr\",\n\tscore: 87,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"James Gosling\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ken Thompson\",\n\tscore: 86,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Kevin Mitnick\",\n\tscore: 41,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Linus Torvalds\",\n\tscore: 76,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Niklaus Wirth\",\n\tscore: 78,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Rebecca Heineman\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Xiao Tian\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ying Cracker\",\n\tscore: 95,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Albert Gonzalez\",\n\tscore: 56,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Brian Kernaghan\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 38,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Donald Knuth\",\n\tscore: 85,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Grace Hopper\",\n\tscore: 53,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Hack Kerr\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"James Gosling\",\n\tscore: 42,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ken Thompson\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Kevin Mitnick\",\n\tscore: 40,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Linus Torvalds\",\n\tscore: 91,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Niklaus Wirth\",\n\tscore: 51,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Rebecca Heineman\",\n\tscore: 79,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 37,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Xiao Tian\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ying Cracker\",\n\tscore: 45,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Ada Lovelace\",\n\tscore: 65,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Albert Gonzalez\",\n\tscore: 52,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Brian Kernaghan\",\n\tscore: 61,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 59,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Donald Knuth\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Grace Hopper\",\n\tscore: 40,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Hack Kerr\",\n\tscore: 102,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"James Gosling\",\n\tscore: 39,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Ken Thompson\",\n\tscore: 83,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Kevin Mitnick\",\n\tscore: 37,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Linus Torvalds\",\n\tscore: 65,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Niklaus Wirth\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Rebecca Heineman\",\n\tscore: 32,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Xiao Tian\",\n\tscore: 52,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Ying Cracker\",\n\tscore: 62,\n\tgrade: \"D\"\n}];\nexport default students;\n')" + ] + }, + { + "description": "Set `first` to the first item in the `students` array.", + "tests": [ + "00/02" + ], + "actions": [ + "open('00-setup.js')", + "set('// Welcome to CodeRoad!\nimport students from './data/students';\n\nvar first = ::>\n')" + ], + "hints": [ + "Get the first item in students using the array index", + "Access the title of `students[0]`" + ] + }, + { + "description": "Set `myName` to the \"name\" of the first student in the list.", + "tests": [ + "00/03" + ], + "actions": [ + "insert('var myName = ::>\n')" + ], + "hints": [ + "Get the first \"name\" in the students using the array index", + "Access the \"name\" of `first`", + "Try `first.name`" + ] + }, + { + "description": "Log your name to the console.", + "tests": [ + "00/04" + ], + "actions": [ + "insert('\nconsole.log(::>);\n')" + ], + "hints": [ + "Use `console.log`", + "Use `console.log(myName)`" + ] + } + ], + "onPageComplete": "Now we're ready to get started with `filter`ing our data." + }, + { + "title": "Filter", + "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nconst list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nconst list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", + "tasks": [ + { + "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", + "tests": [ + "01/01" + ], + "actions": [ + "open('01-filter.js')", + "set('import students from './data/students';\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" + ], + "hints": [ + "Some tasks have hints", + "Check if `student.name` matches \"Ada Lovelace\"", + "Use `===` to check equality" + ] + }, + { + "description": "Set `const myData` to filter with the `isAda` function.", + "tests": [ + "01/02" + ], + "actions": [ + "insert('// run the function name in filter\nconst myData = students.filter(::>);\n')" + ], + "hints": [ + "Add a function to the `filter` call: `Array.filter(function() {})`", + "Pass `isAda` into your `filter` call" + ] + }, + { + "description": "Write a filter condition called `isGoodGrade` that will filter out any \"D\" or \"F\" grades.", + "tests": [ + "01/03" + ], + "actions": [ + "insert('\n\n// return true if student.grade is not a \"D\" or \"F\"\nfunction isGoodGrade(student) {\n ::>\n}\n')" + ], + "hints": [ + "match for `student.grade` that isn't \"D\" or \"F\"", + "use `!==` to check non-equality", + "Match for both: `student.grade !== \"D\" && student.grade !== \"F\"`" + ] + }, + { + "description": "Set `const myBest` to your scores, excluding any grades that are \"D\" or \"F\".", + "tests": [ + "01/04" + ], + "actions": [ + "insert('// filter out \"D\"'s and \"F\"'s here\nconst myBest = myData.filter(::>);\n\n')" + ] + } + ], + "onPageComplete": "In the next step we'll look at how to `sort` data" + }, + { + "title": "Sort", + "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", + "tasks": [ + { + "description": "load `myBest`", + "tests": [ + "02/01" + ], + "actions": [ + "open('data/myBest.js')", + "set('const myBest = [{\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ada Lovelace\",\n\tscore: 91,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ada Lovelace\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ada Lovelace\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ada Lovelace\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ada Lovelace\",\n\tscore: 82,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}];\nexport default myBest;\n')" + ] + }, + { + "description": "`compareScore` should return 1 if the first score is less than the second", + "tests": [ + "02/02" + ], + "actions": [ + "open('02-sort.js')", + "set('import myBest from './data/myBest';\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + ] + }, + { + "description": "`compareScore` should return -1 if the first score is more than the second", + "tests": [ + "02/03" + ], + "hints": [ + "set the second case to `b.score < a.score`" + ] + }, + { + "description": "`compareScore` should return 0 if the first score is the same as the second", + "tests": [ + "02/04" + ], + "hints": [ + "no case is necessary, use the `default` case" + ] + }, + { + "description": "Set `mySorted` to the result of `myBest` sorted by `compareScore`", + "tests": [ + "02/05" + ], + "actions": [ + "insert('// use the compare function to sort myBest\nconst mySorted = myBest::>\n')" + ], + "hints": [ + "try using `myBest.sort()`" + ] + } + ], + "onPageComplete": "In the next step we'll look at changing data with `map`" + }, { "title": "Map", "description": "Array -> run a function over each item -> Array\n\nYou've filtered and sorted our data, but neither of those actually change the data.\n\nWouldn't it be simpler if you could just change your grades?\n\nYou can use the array method `map` to run a function that returns changes to your data.\n\nAs an example, let's look at how you would increment each number in an array.\n\n```js\nfunction addOne(num) {\n return num + 1;\n}\n\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\nfunction addToVal(obj) {\n obj.val += 1;\n return obj;\n}\n[{ val: 1}].map(addToVal);\n//> [{ val: 2 }]\n```\n\n`map` can change data, and it can also alter structure of the data you're working with.\n\n```js\nfunction makeObject(num) {\n return { val: num };\n}\n\n[1, 2].map(makeObject);\n//> [{ val: 1 }, { val: 2 }]\n```\n\nSimilarly, `map` can also restrict the data you want to work with. See the example below to see another way scores could be sorted.\n\n```js\nmyBest\n .map(function(student) {\n return student.score;\n })\n .sort()\n .reverse()\n//> [93, 91, 88, 88, 82, 81, 73]\n```\n\nIn this example, `map` transformed an object with keys of 'title', 'instructor', 'name', 'score' and 'grade', to an array of just scores. Values weren't changed, but rather limited to a smaller subset of scores.\n\n`map` is powerful. Let's see what you can do with it.\n\nThose D & F grades would look a lot better if they suddenly became A's.\n\nLet's go back to before we filtered out the bad grades, and instead change the grades to A's.", @@ -29,8 +202,8 @@ ], "hints": [ "give `changeGrade` a parameter, call it \"course\"", - "match for `course.grade`", - "match where `course.grade === 'A'`" + "set `course.grade` to \"A\"", + "return the changed course" ] }, { @@ -54,9 +227,9 @@ "insert('\nfunction increaseScore(course) {\n ::>\n}\n\n// map over `mySlightlyChanged` with a function `increaseScore` to increment each score by 12\nconst mySlightlyChanged = myCourses;\n')" ], "hints": [ - "give `increaseScore` a parameter, call it \"student\"", - "it should increase `student.score`", - "return `student`" + "give `increaseScore` a parameter, call it \"course\"", + "it should increase `course.score`", + "return `course`" ] }, { @@ -65,22 +238,21 @@ "03/05" ], "hints": [ - "use an if clause within `increaseScore`", - "try `if (student.score >= 95) { student.score = 95 }`" + "Use `Math.min(x, y)`", + "set `course.score` to `Math.min(95, course.score + 12)`" ] }, { - "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores.", + "description": "One more problem. Now the scores don't match the grades. you have 95 score in \"3D Computer Graphics\", but only a \"B\" grade. Update your `increaseScore` function to also update the grade by using the `getGrade` function", "tests": [ "03/06" ], "actions": [ - "insert('\n// change `getGrade` to accept a \"course\" instead of a \"score\"\n// and return that updated \"course\"\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n// map `myFixed` to update grades to the new scores\nconst myFixed = mySlightlyChanged;\n')" + "insert('\n// use getGrade to set the course grade\n// update `increaseScore` to also update the grade\nfunction getGrade(score) {\n switch (true) {\n case (score >= 90):\n return \"A\";\n case (score >= 80):\n return \"B\";\n case (score >= 70):\n return \"C\";\n case (score >= 60):\n return \"D\";\n default:\n return \"F\";\n }\n}\n\n')" ], "hints": [ - "change `getGrade` to take a `student` param instead of `score`", - "change the grade and return the `student`", - "set `student.grade = \"A\"` and return `student`" + "call `getGrade` inside of `increaseScore`", + "the `increaseScore` function should set course.grade equal to `getGrade(course.score)`" ] }, { @@ -89,12 +261,13 @@ "03/07" ], "actions": [ - "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nconst scoresAndGrades = myFixed::>\n')" + "insert('\n// set `scoresAndGrades` to an array of scores and grades\n// it should return an array of objects like this: {score: 75, grade: 'C'}\nconst scoresAndGrades = mySlightlyChanged.map(::>)\n')" ], "hints": [ "use `map` to return only the \"score\" & \"grade\" fields", "map with a function with a parameter, call it \"student\"", - "return `{ score: student.score, grade: student.grade }`" + "you can destructure the param to be `function({score, grade})`", + "then simply return { score, grade }" ] } ], @@ -102,7 +275,7 @@ }, { "title": "forEach", - "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nvar x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nvar y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", + "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nlet x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nlet y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", "tasks": [ { "description": "load \"myFixed\"", @@ -167,7 +340,7 @@ }, { "title": "find", - "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nvar data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", + "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nconst data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", "tasks": [ { "description": "load \"students\" data", @@ -175,22 +348,23 @@ "05/01" ], "actions": [ - "open('data/students2.js')", - "set('const students = [{\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"!f\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Albert Gonzalez\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Brian Kernaghan\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Danielle Bunten Berry\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Grace Hopper\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Hack Kerr\",\n score: 85,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"James Gosling\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ken Thompson\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Kevin Mitnick\",\n score: 72,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Linus Torvalds\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Rebecca Heineman\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Tim Berners-Lee\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Xiao Tian\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ying Cracker\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"in\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Albert Gonzalez\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Brian Kernaghan\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Danielle Bunten Berry\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Donald Knuth\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Grace Hopper\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Hack Kerr\",\n score: 86,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"James Gosling\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ken Thompson\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Kevin Mitnick\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Linus Torvalds\",\n score: 90,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Rebecca Heineman\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Tim Berners-Lee\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Xiao Tian\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ying Cracker\",\n score: 77,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"dt\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Albert Gonzalez\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Brian Kernaghan\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Danielle Bunten Berry\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Donald Knuth\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Grace Hopper\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Hack Kerr\",\n score: 92,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"James Gosling\",\n score: 97,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ken Thompson\",\n score: 64,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Linus Torvalds\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Niklaus Wirth\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Rebecca Heineman\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Tim Berners-Lee\",\n score: 98,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Xiao Tian\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ying Cracker\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Donald Knuth\",\n score: 44,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Albert Gonzalez\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Brian Kernaghan\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Danielle Bunten Berry\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"he\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Grace Hopper\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Hack Kerr\",\n score: 75,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"James Gosling\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ken Thompson\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Kevin Mitnick\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Linus Torvalds\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Niklaus Wirth\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Rebecca Heineman\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Tim Berners-Lee\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ying Cracker\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"be\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Albert Gonzalez\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Brian Kernaghan\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Danielle Bunten Berry\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Grace Hopper\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Hack Kerr\",\n score: 83,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"James Gosling\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ken Thompson\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Linus Torvalds\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Niklaus Wirth\",\n score: 50,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Rebecca Heineman\",\n score: 33,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Tim Berners-Lee\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ying Cracker\",\n score: 60,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"st\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Albert Gonzalez\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Brian Kernaghan\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Danielle Bunten Berry\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Donald Knuth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Grace Hopper\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Hack Kerr\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"James Gosling\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ken Thompson\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Kevin Mitnick\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Linus Torvalds\",\n score: 63,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Rebecca Heineman\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Tim Berners-Lee\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Xiao Tian\",\n score: 49,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ying Cracker\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"re\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Albert Gonzalez\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Brian Kernaghan\",\n score: 69,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Danielle Bunten Berry\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Donald Knuth\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Grace Hopper\",\n score: 31,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Hack Kerr\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"James Gosling\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ken Thompson\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Kevin Mitnick\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Linus Torvalds\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Niklaus Wirth\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Rebecca Heineman\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Tim Berners-Lee\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Xiao Tian\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ying Cracker\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"ve\",\n score: 82,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Albert Gonzalez\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Brian Kernaghan\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Donald Knuth\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Grace Hopper\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Hack Kerr\",\n score: 87,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"James Gosling\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ken Thompson\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Kevin Mitnick\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Linus Torvalds\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Rebecca Heineman\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Tim Berners-Lee\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Xiao Tian\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ying Cracker\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"ng\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Albert Gonzalez\",\n score: 56,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Brian Kernaghan\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Donald Knuth\",\n score: 85,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Grace Hopper\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Hack Kerr\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"James Gosling\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ken Thompson\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Kevin Mitnick\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Linus Torvalds\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Niklaus Wirth\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Rebecca Heineman\",\n score: 79,\n grade: \"C\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Tim Berners-Lee\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Xiao Tian\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ying Cracker\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"e!\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Albert Gonzalez\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Brian Kernaghan\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Danielle Bunten Berry\",\n score: 59,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Donald Knuth\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Grace Hopper\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Hack Kerr\",\n score: 102,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"James Gosling\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ken Thompson\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Kevin Mitnick\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Linus Torvalds\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Niklaus Wirth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Rebecca Heineman\",\n score: 32,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Tim Berners-Lee\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Xiao Tian\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ying Cracker\",\n score: 62,\n grade: \"D\"\n}];\nexport default students;\n')" + "open('data/myCourses2.js')", + "set('const myCourses = [{\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"!f\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Albert Gonzalez\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Brian Kernaghan\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Danielle Bunten Berry\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Grace Hopper\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Hack Kerr\",\n score: 85,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"James Gosling\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ken Thompson\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Kevin Mitnick\",\n score: 72,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Linus Torvalds\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Rebecca Heineman\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Tim Berners-Lee\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Xiao Tian\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ying Cracker\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"in\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Albert Gonzalez\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Brian Kernaghan\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Danielle Bunten Berry\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Donald Knuth\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Grace Hopper\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Hack Kerr\",\n score: 86,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"James Gosling\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ken Thompson\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Kevin Mitnick\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Linus Torvalds\",\n score: 90,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Rebecca Heineman\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Tim Berners-Lee\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Xiao Tian\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ying Cracker\",\n score: 77,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"dt\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Albert Gonzalez\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Brian Kernaghan\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Danielle Bunten Berry\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Donald Knuth\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Grace Hopper\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Hack Kerr\",\n score: 92,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"James Gosling\",\n score: 97,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ken Thompson\",\n score: 64,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Linus Torvalds\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Niklaus Wirth\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Rebecca Heineman\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Tim Berners-Lee\",\n score: 98,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Xiao Tian\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ying Cracker\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Donald Knuth\",\n score: 44,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Albert Gonzalez\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Brian Kernaghan\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Danielle Bunten Berry\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"he\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Grace Hopper\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Hack Kerr\",\n score: 75,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"James Gosling\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ken Thompson\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Kevin Mitnick\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Linus Torvalds\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Niklaus Wirth\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Rebecca Heineman\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Tim Berners-Lee\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ying Cracker\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"be\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Albert Gonzalez\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Brian Kernaghan\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Danielle Bunten Berry\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Grace Hopper\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Hack Kerr\",\n score: 83,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"James Gosling\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ken Thompson\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Linus Torvalds\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Niklaus Wirth\",\n score: 50,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Rebecca Heineman\",\n score: 33,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Tim Berners-Lee\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ying Cracker\",\n score: 60,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"st\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Albert Gonzalez\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Brian Kernaghan\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Danielle Bunten Berry\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Donald Knuth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Grace Hopper\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Hack Kerr\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"James Gosling\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ken Thompson\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Kevin Mitnick\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Linus Torvalds\",\n score: 63,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Rebecca Heineman\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Tim Berners-Lee\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Xiao Tian\",\n score: 49,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ying Cracker\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"re\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Albert Gonzalez\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Brian Kernaghan\",\n score: 69,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Danielle Bunten Berry\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Donald Knuth\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Grace Hopper\",\n score: 31,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Hack Kerr\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"James Gosling\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ken Thompson\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Kevin Mitnick\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Linus Torvalds\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Niklaus Wirth\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Rebecca Heineman\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Tim Berners-Lee\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Xiao Tian\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ying Cracker\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"ve\",\n score: 82,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Albert Gonzalez\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Brian Kernaghan\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Donald Knuth\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Grace Hopper\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Hack Kerr\",\n score: 87,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"James Gosling\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ken Thompson\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Kevin Mitnick\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Linus Torvalds\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Rebecca Heineman\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Tim Berners-Lee\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Xiao Tian\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ying Cracker\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"ng\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Albert Gonzalez\",\n score: 56,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Brian Kernaghan\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Donald Knuth\",\n score: 85,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Grace Hopper\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Hack Kerr\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"James Gosling\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ken Thompson\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Kevin Mitnick\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Linus Torvalds\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Niklaus Wirth\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Rebecca Heineman\",\n score: 79,\n grade: \"C\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Tim Berners-Lee\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Xiao Tian\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ying Cracker\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"e!\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Albert Gonzalez\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Brian Kernaghan\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Danielle Bunten Berry\",\n score: 59,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Donald Knuth\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Grace Hopper\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Hack Kerr\",\n score: 102,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"James Gosling\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ken Thompson\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Kevin Mitnick\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Linus Torvalds\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Niklaus Wirth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Rebecca Heineman\",\n score: 32,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Tim Berners-Lee\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Xiao Tian\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ying Cracker\",\n score: 62,\n grade: \"D\"\n}];\nexport default myCourses;\n')" ] }, { - "description": "`filter` to `students` in the class titled \"Web Security\"", + "description": "`filter` to `courses` in the class titled \"Web Security\"", "tests": [ "05/02" ], "actions": [ "open('05-find.js')", - "set('import students from './data/students2';\n// Array.find(fn)\n\n// filter for the student title matches \"Web Security\"\nvar myClass = students.filter(::>);\n')" + "set('import courses from './data/myCourses2';\n// Array.find(fn)\n\n// filter for the course title matching \"Web Security\"\nconst myClass = courses.filter(::>);\n')" ], "hints": [ - "create a `filter` function", - "filter for `student.title === \"Web Security\"`" + "create a `filter` function that takes a param `course`", + "return `true` if a condition matches, otherwise `false`", + "filter for `course.title === \"Web Security\"`" ] }, { @@ -199,8 +373,8 @@ "05/03" ], "actions": [ - "insert('\nvar otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", - "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nvar unknownStudent = myClass.find();\n')" + "insert('\nconst otherStudents = [\"Albert Gonzalez\", \"Brian Kernaghan\", \"Danielle Bunten Berry\", \"Donald Knuth\", \"Grace Hopper\", \"Hack Kerr\", \"James Gosling\", \"Ken Thompson\", \"Kevin Mitnick\", \"Linus Torvalds\", \"Niklaus Wirth\", \"Rebecca Heineman\", \"Tim Berners-Lee\", \"Xiao Tian\", \"Ying Cracker\"];\n\n')", + "insert('// search for a student with a name\n// not matching students in `otherStudents`\nfunction notInList(::>) {\n\n}\n\n// find using `notInList`\nconst unknownStudent = myClass.find();\n')" ], "hints": [ "use `indexOf` to find what doesn't match", @@ -209,12 +383,12 @@ ] }, { - "description": "`filter` down to students without known names", + "description": "`filter` down to students from courses without known names", "tests": [ "05/04" ], "actions": [ - "insert('\n// filter using `notInList`\nvar unknownStudentList = students.filter(::>);\n')" + "insert('\n// filter using `notInList`\nconst unknownStudentList = courses.filter(::>);\n')" ], "hints": [ "consider reusing a function" @@ -226,10 +400,11 @@ "05/05" ], "actions": [ - "insert('\n// list only student names\nvar unknownStudentNames = unknownStudentList.map(::>);\n')" + "insert('\n// list only student names\nconst unknownStudentNames = unknownStudentList.map(::>);\n')" ], "hints": [ - "use `map` to return only the `student.name`" + "use `map` to return only the `student.name`", + "try this inside of your map call: `student => student.name`" ] }, { @@ -238,7 +413,7 @@ "05/06" ], "actions": [ - "insert('\n// use `.join('')` to join the array of strings\nvar decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" + "insert('\n// use `.join('')` to join the array of strings\nconst decodedName = unknownStudentNames::>;\nconsole.log(decodedName);\n')" ], "hints": [ "call `join` following `unknownStudentNames`" @@ -249,7 +424,7 @@ }, { "title": "concat", - "description": "Array + Array -> Array\n\nBefore we've been working on a structured set of student data.\n\n```js\n// array of students\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n// students in courses...\n]\n```\n\nTo be safe, let's now work on the original data set. Notice how it is structured differently.\n\n```js\n// array of courses\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"students\": [\n {\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n // students...\n ]\n }\n // courses...\n]\n```\n\nIn this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses?\n\nWeird things happen when you start combining arrays. We can use `concat` to bring sanity.\n\n```js\n[1, 2] + [3, 4];\n//> \"1, 23, 4\"\n\n[1, 2].push([3, 4]);\n//> 3\n\n[1, 2].join([3, 4]);\n//> \"13, 42\"\n\n[1, 2].concat([3, 4]);\n//> [1, 2, 3, 4]\n```\n\nUnfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`).\n\n`flatten` should loop over an array and `concat` each element.\n\nLet's look at an abstraction of what we need to do:\n\n```js\nvar start = [{\n a: 1,\n c: [\n { b: 1 }\n ]\n}, {\n a: 2,\n c: [\n { b: 2 }, { b: 3 }\n ]\n}];\n\nvar middle = start.map(function(outer) {\n return outer.c.map(function(inner) {\n return {\n a: outer.a,\n b: inner.b\n };\n });\n});\n//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ]\n\nvar end = pre.flatten();\n//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}]\n```\n\nBack to business.\n\nWe have a suspect in mind: a classmate named \"Hack Kerr\". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name.\n\nWe'll test out flatten, then re-create our student array of data from the original course data.", + "description": "Array + Array -> Array\n\nBefore we've been working on a structured set of student data.\n\n```js\n// array of students\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n// students in courses...\n]\n```\n\nTo be safe, let's now work on the original data set. Notice how it is structured differently.\n\n```js\n// array of courses\n[\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"students\": [\n {\n \"name\": \"Rebecca Heineman\",\n \"score\": 71,\n \"grade\": \"C\"\n }\n // students...\n ]\n }\n // courses...\n]\n```\n\nIn this data set, there is an array of students within an array of courses. So how can we recreate our original array of students from the courses?\n\nWeird things happen when you start combining arrays. We can use `concat` to bring sanity.\n\n```js\n[1, 2] + [3, 4];\n//> \"1, 23, 4\"\n\n[1, 2].push([3, 4]);\n//> 3\n\n[1, 2].join([3, 4]);\n//> \"13, 42\"\n\n[1, 2].concat([3, 4]);\n//> [1, 2, 3, 4]\n```\n\nUnfortunately, Javascript is missing a built in array method to concat multiple arrays together: let's call it `flatten` (sometimes called `concatAll`).\n\n`flatten` should loop over an array and `concat` each element.\n\nLet's look at an abstraction of what we need to do:\n\n```js\nconst start = [{\n a: 1,\n c: [\n { b: 1 }\n ]\n}, {\n a: 2,\n c: [\n { b: 2 }, { b: 3 }\n ]\n}];\n\nconst middle = start.map(function(outer) {\n return outer.c.map(function(inner) {\n return {\n a: outer.a,\n b: inner.b\n };\n });\n});\n//> [ [{ a: 1, b: 1 }], [{a: 2, b: 2}, {a: 2, b: 3}] ]\n\nconst end = pre.flatten();\n//> [{a: 1, b: 1}, {a: 2, b: 2}, {a: 2, b: 3}]\n```\n\nBack to business.\n\nWe have a suspect in mind: a classmate named \"Hack Kerr\". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name.\n\nWe'll test out flatten, then re-create our student array of data from the original course data.", "tasks": [ { "description": "load \"courses\"", @@ -269,7 +444,7 @@ "actions": [ "open('06-concat.js')", "set('import courses from './data/courses2';\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", - "insert('\nvar numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nvar flattenedArray = numberedList::>;\n')" + "insert('\nconst numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nconst flattenedArray = numberedList::>;\n')" ], "hints": [ "call `.flatten()` on `numberedList`" @@ -281,7 +456,7 @@ "06/03" ], "actions": [ - "insert('\n// map over courses then\n// map over students inside of courses\nvar doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" + "insert('\n// map over courses then\n// map over students inside of courses\nconst doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" ], "hints": [ "pair `course.title`", @@ -294,7 +469,7 @@ "06/04" ], "actions": [ - "insert('// `flatten` doubleArray\nvar students = doubleArray::>;\n')" + "insert('// `flatten` doubleArray\nconst students = doubleArray::>;\n')" ], "hints": [ "call `.flatten()` on `doubleArray`" @@ -306,11 +481,11 @@ "06/05" ], "actions": [ - "insert('\nvar suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nvar suspectData = students::>;\n')" + "insert('\nconst suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nconst suspectData = students::>;\n')" ] }, { - "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nvar newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", + "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nconst newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", "tests": [ "06/06" ], @@ -323,7 +498,7 @@ }, { "title": "reduce", - "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nvar initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", + "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nconst initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", "tasks": [ { "description": "Use `reduce` to sum the numbers in the `practice` array", @@ -332,7 +507,7 @@ ], "actions": [ "open('07-reduce.js')", - "set('import courses from './data/courses2';\n// Array.reduce(fn(a, b), initialValue)\n\nvar practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nvar total = practice.reduce(::>);\n')" + "set('import courses from './data/courses2';\n// Array.reduce(fn(a, b), initialValue)\n\nconst practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nconst total = practice.reduce(::>);\n')" ], "hints": [ "with only numbers, the initialValue defaults to 0", @@ -345,7 +520,7 @@ "07/02" ], "actions": [ - "insert('\nvar averages = courses.map(function(course) {\n var sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" + "insert('\nconst averages = courses.map(function(course) {\n const sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" ], "hints": [ "set the initialValue to 0", @@ -370,7 +545,7 @@ ], "actions": [ "open('07-reduce.js')", - "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nvar suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n var index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" + "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nconst suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n const index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" ], "hints": [ "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", @@ -385,7 +560,7 @@ "07/05" ], "actions": [ - "insert('\nvar suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n var difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" + "insert('\nconst suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n const difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" ], "hints": [ "You may want to use a second param: `index`", @@ -399,7 +574,7 @@ "07/06" ], "actions": [ - "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nvar likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" + "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nconst likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" ], "hints": [ "use `.join(', ')`" diff --git a/tutorial/03/02.js b/tutorial/03/02.js index 2050d67..898ab0b 100644 --- a/tutorial/03/02.js +++ b/tutorial/03/02.js @@ -16,12 +16,19 @@ describe('02 function changeGrade', () => { expect(changeGrade).to.have.length(1); }); - it('should try changing `student.grade` first before returning `student`', () => { + it('should try changing `course.grade` first before returning `course`', () => { const regex = /return [a-zA-Z]+\.grade/; const func = changeGrade.toString(); expect(func.match(regex)).to.be.null; }); + it('doesn\'t return anything', () => { + const test = { + grade: 'D' + }; + expect(changeGrade(test)).to.be.defined; + }); + it('should change grades from a D to an A', () => { const test = { grade: 'D' diff --git a/tutorial/03/04.js b/tutorial/03/04.js index 2b45dc1..c72f694 100644 --- a/tutorial/03/04.js +++ b/tutorial/03/04.js @@ -15,23 +15,22 @@ describe('04 function increaseScore', () => { }); it('should try changing the `score` first before returning the changed object', () => { - var regex = /return [a-zA-Z]+\.score/; - var func = increaseScore.toString(); + const regex = /return [a-zA-Z]+\.score/; + const func = increaseScore.toString(); expect(func.match(regex)).to.be.null; }); it('should increment scores by 12 points', () => { - var test = { - score: 50 + const test = { + score: 50, + grade: 'D' }; - expect(increaseScore(test)).to.deep.equal({ - score: 62 - }); + expect(increaseScore(test).score).to.equal(62); }); }); -describe('03 var mySlightlyChanged', () => { +describe('04 const mySlightlyChanged', () => { const mySlightlyChanged = map.__get__('mySlightlyChanged'); @@ -44,9 +43,7 @@ describe('03 var mySlightlyChanged', () => { }); it('should increment scores by 12', () => { - var scores = mySlightlyChanged.map(function(x) { - return x.score; - }); + const scores = mySlightlyChanged.map((x) => x.score); expect(Math.min.apply(Math, scores)).to.equal(70); }); diff --git a/tutorial/03/05.js b/tutorial/03/05.js index 8ffa5fe..0936352 100644 --- a/tutorial/03/05.js +++ b/tutorial/03/05.js @@ -16,32 +16,28 @@ describe('05 function increaseScore', () => { it('shouldn\'t change scores under 95', () => { const test = { - score: 82 + score: 82, + grade: 'A', }; - expect(increaseScore(test)).to.deep.equal({ - score: 94 - }); + expect(increaseScore(test).score).to.equal(94); }); it('should change scores over 95 to 95', () => { const test = { - score: 84 + score: 84, + grade: 'A', }; - expect(increaseScore(test)).to.deep.equal({ - score: 95 - }); + expect(increaseScore(test).score).to.equal(95); }); }); -describe('04 var mySlightlyChanged', () => { +describe('05 const mySlightlyChanged', () => { const mySlightlyChanged = map.__get__('mySlightlyChanged'); it('should cap scores at 95', () => { - const scores = mySlightlyChanged.map(function(x) { - return x.score; - }); + const scores = mySlightlyChanged.map((x) => x.score); expect(Math.max.apply(Math, scores)).to.equal(95); }); diff --git a/tutorial/03/06.js b/tutorial/03/06.js index 4741fad..857a0c5 100644 --- a/tutorial/03/06.js +++ b/tutorial/03/06.js @@ -17,7 +17,7 @@ describe('06 function getGrade', () => { }); -describe('05 const mySlightlyChanged', () => { +describe('06 const mySlightlyChanged', () => { const mySlightlyChanged = map.__get__('mySlightlyChanged'); diff --git a/tutorial/03/map.md b/tutorial/03/map.md index d9af6b6..8e0396b 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -183,16 +183,16 @@ const mySlightlyChanged = myCourses; + Wait. Now you're getting 105 in "Algorithm Design" class. Fix `increaseScore` so that the maximum score is 95. That should be less suspicious. @test('03/05') -@hint('use an if clause within `increaseScore`') -@hint('try `if (student.score >= 95) { student.score = 95 }`') +@hint('Use `Math.min(x, y)`') +@hint('set `course.score` to `Math.min(95, course.score + 12)`') -+ One more problem. Now the scores don't match the grades. you have 95 score in "3D Computer Graphics", but only a "B" grade. Set `myFixed` as the result of using the `getGrade` function to set grades according to their new scores. ++ One more problem. Now the scores don't match the grades. you have 95 score in "3D Computer Graphics", but only a "B" grade. Update your `increaseScore` function to also update the grade by using the `getGrade` function @test('03/06') @action(insert( ``` -// change `getGrade` to accept a "course" instead of a "score" -// and return that updated "course" +// use getGrade to set the course grade +// update `increaseScore` to also update the grade function getGrade(score) { switch (true) { case (score >= 90): @@ -208,13 +208,10 @@ function getGrade(score) { } } -// map `myFixed` to update grades to the new scores -const myFixed = mySlightlyChanged; ``` )) -@hint('change `getGrade` to take a `course` param instead of `score`') -@hint('change the grade and return the `course`') -@hint('set `course.grade = "A"` and return `course`') +@hint('call `getGrade` inside of `increaseScore`') +@hint('the `increaseScore` function should set course.grade equal to `getGrade(course.score)`') + Check to make sure everything is working. Set `scoresAndGrades` to an array of scores and grades only. @test('03/07') @@ -223,11 +220,12 @@ const myFixed = mySlightlyChanged; // set `scoresAndGrades` to an array of scores and grades // it should return an array of objects like this: {score: 75, grade: 'C'} -const scoresAndGrades = myFixed::> +const scoresAndGrades = mySlightlyChanged.map(::>) ``` )) @hint('use `map` to return only the "score" & "grade" fields') @hint('map with a function with a parameter, call it "student"') -@hint('return `{ score: student.score, grade: student.grade }`') +@hint('you can destructure the param to be `function({score, grade})`') +@hint('then simply return { score, grade }') @onPageComplete('In the next step we'll compare `map` with `forEach`') diff --git a/tutorial/05/01.js b/tutorial/05/01.js index 171db63..3a09058 100644 --- a/tutorial/05/01.js +++ b/tutorial/05/01.js @@ -1,11 +1,11 @@ const expect = require('chai').expect; -describe('01 students2 data', () => { +describe('01 courses2 data', () => { - const students = require('BASE/data/students2.js'); + const courses = require('BASE/data/courses2.js'); - it('should be loaded in "data/students2.js"', () => { - expect(students).to.be.defined; + it('should be loaded in "data/courses2.js"', () => { + expect(courses).to.be.defined; }); }); diff --git a/tutorial/05/02.js b/tutorial/05/02.js index e6cbc69..4801c40 100644 --- a/tutorial/05/02.js +++ b/tutorial/05/02.js @@ -2,14 +2,10 @@ const find = require('BASE/05-find.js'); describe('02 const myClass', () => { - const students = find.__get__('students'); const myClass = find.__get__('myClass'); it('should filter to "Web Security" class data', () => { - const result = students.filter((course) => { - return course.title === 'Web Security'; - }); - expect(myClass).to.deep.equal(result); + expect(myClass).to.have.length(16); }); }); diff --git a/tutorial/05/04.js b/tutorial/05/04.js index cbb1891..29c857d 100644 --- a/tutorial/05/04.js +++ b/tutorial/05/04.js @@ -7,9 +7,7 @@ describe('04 const unknownStudentList', () => { }); it('should find 10 unknown students across classes', () => { - const names = unknownStudentList.map((student) => { - return student.name; - }).join(''); + const names = unknownStudentList.map((student) => student.name).join(''); expect(names).to.equal('!findthebestrevenge!'); }); diff --git a/tutorial/05/students2.js b/tutorial/05/courses.js similarity index 99% rename from tutorial/05/students2.js rename to tutorial/05/courses.js index 3daf28b..f1c8afd 100644 --- a/tutorial/05/students2.js +++ b/tutorial/05/courses.js @@ -1,4 +1,4 @@ -const students = [{ +const courses = [{ title: "Relational Databases", instructor: "Sean Quentin Lewis", name: "!f", @@ -959,4 +959,4 @@ const students = [{ score: 62, grade: "D" }]; -export default students; +export default courses; diff --git a/tutorial/05/find.md b/tutorial/05/find.md index a87d96e..cb1d32d 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -27,10 +27,10 @@ Find is great for performantly matching unique values in data, such as an "id", + load "students" data @test('05/01') -@action(open('data/students2.js')) +@action(open('data/myCourses2.js')) @action(set( ``` -const students = [{ +const myCourses = [{ title: "Relational Databases", instructor: "Sean Quentin Lewis", name: "!f", @@ -991,24 +991,25 @@ const students = [{ score: 62, grade: "D" }]; -export default students; +export default myCourses; ``` )) -+ `filter` to `students` in the class titled "Web Security" ++ `filter` to `courses` in the class titled "Web Security" @test('05/02') @action(open('05-find.js')) @action(set( ``` -import students from './data/students2'; +import courses from './data/myCourses2'; // Array.find(fn) -// filter for the student title matches "Web Security" -const myClass = students.filter(::>); +// filter for the course title matching "Web Security" +const myClass = courses.filter(::>); ``` )) -@hint('create a `filter` function') -@hint('filter for `student.title === "Web Security"`') +@hint('create a `filter` function that takes a param `course`') +@hint('return `true` if a condition matches, otherwise `false`') +@hint('filter for `course.title === "Web Security"`') + `find` the name in `myClass` that isn't in the list of known students @test('05/03') @@ -1035,13 +1036,13 @@ const unknownStudent = myClass.find(); @hint('use `otherStudents.indexOf(x) === -1` to find what doesn't match') @hint('match for `student.name`') -+ `filter` down to students without known names ++ `filter` down to students from courses without known names @test('05/04') @action(insert( ``` // filter using `notInList` -const unknownStudentList = students.filter(::>); +const unknownStudentList = courses.filter(::>); ``` )) @hint('consider reusing a function') @@ -1056,6 +1057,7 @@ const unknownStudentNames = unknownStudentList.map(::>); ``` )) @hint('use `map` to return only the `student.name`') +@hint('try this inside of your map call: `student => student.name`') + `join('')` the array of names to output the result as a string @test('05/06') diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index ce81137..4447c97 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -8,9 +8,9 @@ Keywords: javascript, functional Length: 1-2 hours - - - +@import('00/setup') +@import('01/filter') +@import('02/sort') @import('03/map') @import('04/forEach') @import('05/find') From 7ee37e2a436f64a7ec070e05de60137e57648a95 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 9 Aug 2016 12:28:42 -0700 Subject: [PATCH 36/46] tutorial update for mocha 0.10 complete --- README.md | 4 +- coderoad.json | 40 +++++++++--------- tutorial/06/06.js | 2 +- tutorial/06/concat.md | 10 ++--- tutorial/07/01.js | 14 +++---- tutorial/07/02.js | 14 ++++--- tutorial/07/03.js | 8 ++-- tutorial/07/reduce.md | 98 ++++++++++++++++++++----------------------- 8 files changed, 90 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 4a575ef..339684c 100644 --- a/README.md +++ b/README.md @@ -460,9 +460,7 @@ You may have noticed we've already used `reduce` to `flatten` our arrays. ```js Array.prototype.flatten = function() { - return this.reduce(function(a, b) { - return a.concat(b); - }, []); + return this.reduce((a, b) => a.concat(b), []); }; ``` diff --git a/coderoad.json b/coderoad.json index 0b923fd..525c082 100644 --- a/coderoad.json +++ b/coderoad.json @@ -443,7 +443,7 @@ ], "actions": [ "open('06-concat.js')", - "set('import courses from './data/courses2';\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n')", + "set('import courses from './data/courses2';\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n')", "insert('\nconst numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nconst flattenedArray = numberedList::>;\n')" ], "hints": [ @@ -456,7 +456,7 @@ "06/03" ], "actions": [ - "insert('\n// map over courses then\n// map over students inside of courses\nconst doubleArray = courses.map(function(course) {\n return course.students.map(function(student) {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" + "insert('\n// map over courses then\n// map over students inside of courses\nconst doubleArray = courses.map((course) => {\n return course.students.map((student) => {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" ], "hints": [ "pair `course.title`", @@ -476,7 +476,7 @@ ] }, { - "description": "Use the `suspects` array to `filter` to only \"Hack Kerr\"'s data", + "description": "Use the `suspects` array to `filter` to only data matching the names in the `suspects` array", "tests": [ "06/05" ], @@ -498,13 +498,23 @@ }, { "title": "reduce", - "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nconst initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce(function(a, b) {\n return a.concat(b);\n }, []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", + "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nconst initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", "tasks": [ { - "description": "Use `reduce` to sum the numbers in the `practice` array", + "description": "load suspectData. We will come back to this after some practice;", "tests": [ "07/01" ], + "actions": [ + "open('data/suspectData.js')", + "set('const suspectData = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Albert Gonzalez\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Hack Kerr\",\n score:85,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Kevin Mitnick\",\n score:72,\n grade:\"C\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Albert Gonzalez\",\n score:37,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Hack Kerr\",\n score:86,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Kevin Mitnick\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Albert Gonzalez\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Hack Kerr\",\n score:92,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Albert Gonzalez\",\n score:74,\n grade:\"C\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Hack Kerr\",\n score:75,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Kevin Mitnick\",\n score:89,\n grade:\"B\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Albert Gonzalez\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Hack Kerr\",\n score:83,\n grade:\"F\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Albert Gonzalez\",\n score:67,\n grade:\"D\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Hack Kerr\",\n score:96,\n grade:\"A\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Kevin Mitnick\",\n score:75,\n grade:\"C\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Albert Gonzalez\",\n score:39,\n grade:\"F\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Hack Kerr\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Kevin Mitnick\",\n score:81,\n grade:\"B\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Albert Gonzalez\",\n score:70,\n grade:\"C\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Hack Kerr\",\n score:87,\n grade:\"F\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Kevin Mitnick\",\n score:41,\n grade:\"F\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Albert Gonzalez\",\n score:56,\n grade:\"F\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Hack Kerr\",\n score:89,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Kevin Mitnick\",\n score:40,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Albert Gonzalez\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Hack Kerr\",\n score:102,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Kevin Mitnick\",\n score:37,\n grade:\"F\"\n}];\nexport default suspectData;\n')" + ] + }, + { + "description": "Use `reduce` to sum the numbers in the `practice` array", + "tests": [ + "07/02" + ], "actions": [ "open('07-reduce.js')", "set('import courses from './data/courses2';\n// Array.reduce(fn(a, b), initialValue)\n\nconst practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nconst total = practice.reduce(::>);\n')" @@ -517,10 +527,10 @@ { "description": "Not all reduce functions are so easy. `reduce` is a little more difficult to master.\n\n`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages.", "tests": [ - "07/02" + "07/03" ], "actions": [ - "insert('\nconst averages = courses.map(function(course) {\n const sum = course.students.reduce(function(total, student) {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" + "insert('\nconst averages = courses.map((course) => {\n const sum = course.students.reduce((total, student) => {\n ::>\n\n });\n return Math.round(sum / course.students.length, 0);\n});\n')" ], "hints": [ "set the initialValue to 0", @@ -528,16 +538,6 @@ "return the sum of `student.score` and `total`" ] }, - { - "description": "load suspectData", - "tests": [ - "07/03" - ], - "actions": [ - "open('data/suspectData.js')", - "set('const suspectData = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Albert Gonzalez\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Hack Kerr\",\n score:85,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Kevin Mitnick\",\n score:72,\n grade:\"C\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Albert Gonzalez\",\n score:37,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Hack Kerr\",\n score:86,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Kevin Mitnick\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Albert Gonzalez\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Hack Kerr\",\n score:92,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Albert Gonzalez\",\n score:74,\n grade:\"C\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Hack Kerr\",\n score:75,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Kevin Mitnick\",\n score:89,\n grade:\"B\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Albert Gonzalez\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Hack Kerr\",\n score:83,\n grade:\"F\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Albert Gonzalez\",\n score:67,\n grade:\"D\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Hack Kerr\",\n score:96,\n grade:\"A\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Kevin Mitnick\",\n score:75,\n grade:\"C\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Albert Gonzalez\",\n score:39,\n grade:\"F\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Hack Kerr\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Kevin Mitnick\",\n score:81,\n grade:\"B\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Albert Gonzalez\",\n score:70,\n grade:\"C\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Hack Kerr\",\n score:87,\n grade:\"F\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Kevin Mitnick\",\n score:41,\n grade:\"F\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Albert Gonzalez\",\n score:56,\n grade:\"F\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Hack Kerr\",\n score:89,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Kevin Mitnick\",\n score:40,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Albert Gonzalez\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Hack Kerr\",\n score:102,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Kevin Mitnick\",\n score:37,\n grade:\"F\"\n}];\nexport default suspectData;\n')" - ] - }, { "description": "`reduce` to an array of suspect scores from the `suspectData` we collected previously.", "tests": [ @@ -545,7 +545,7 @@ ], "actions": [ "open('07-reduce.js')", - "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nconst suspectScores = suspectData.reduce(function(total, next) {\n // see if suspect name has a list yet\n const index = total.findIndex(function(suspect) {\n return suspect.name === next.name;\n });\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" + "insert('\n// [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...]\nconst suspectScores = suspectData.reduce((total, next) => {\n // see if suspect name has a list yet\n const index = total.findIndex((suspect) => suspect.name === next.name);\n if (index < 0) {\n total.push({\n ::>\n\n });\n } else {\n // push the next score onto the suspects scores\n total[index].scores.push();\n }\n return total;\n}, []);\n\n')" ], "hints": [ "if the name is new, push an object with name & scores: `{ name: '', scores: [42]}`", @@ -560,7 +560,7 @@ "07/05" ], "actions": [ - "insert('\nconst suspectStats = suspectScores.map(function(suspect) {\n // calculate the total difference in scores from the averages\n const difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" + "insert('\nconst suspectStats = suspectScores.map((suspect) => {\n // calculate the total difference in scores from the averages\n const difference = suspect.scores.reduce(::>);\n\n return {\n name: suspect.name,\n scores: suspect.scores,\n difference: difference\n };\n});\n')" ], "hints": [ "You may want to use a second param: `index`", @@ -574,7 +574,7 @@ "07/06" ], "actions": [ - "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nconst likelySuspects = suspectStats.reduce(function(::>) {}, []);\n')" + "insert('\nfunction isCheater(suspect) {\n return suspect.difference > 200;\n}\n\n// reduce down to a string of likely suspects\nconst likelySuspects = suspectStats.reduce((::>) => {}, []);\n')" ], "hints": [ "use `.join(', ')`" diff --git a/tutorial/06/06.js b/tutorial/06/06.js index 9d095b3..34d5b48 100644 --- a/tutorial/06/06.js +++ b/tutorial/06/06.js @@ -16,7 +16,7 @@ describe('06 const newSuspects', () => { }); -describe('05 const suspectData', () => { +describe('06 const suspectData', () => { const suspectData = concat.__get__('suspectData'); diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index 4b33d2d..442f7cc 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -795,9 +795,7 @@ import courses from './data/courses2'; // Array.prototype can be used to create new Array methods Array.prototype.flatten = function() { - return this.reduce(function(a, b) { - return a.concat(b); - }, []); + return this.reduce((a, b) => a.concat(b), []); }; ``` )) @@ -827,8 +825,8 @@ Return the fields: // map over courses then // map over students inside of courses -const doubleArray = courses.map(function(course) { - return course.students.map(function(student) { +const doubleArray = courses.map((course) => { + return course.students.map((student) => { return { // fill in the fields title: ::>'', @@ -855,7 +853,7 @@ const students = doubleArray::>; )) @hint('call `.flatten()` on `doubleArray`') -+ Use the `suspects` array to `filter` to only "Hack Kerr"'s data ++ Use the `suspects` array to `filter` to only data matching the names in the `suspects` array @test('06/05') @action(insert( ``` diff --git a/tutorial/07/01.js b/tutorial/07/01.js index 61e61da..3da82be 100644 --- a/tutorial/07/01.js +++ b/tutorial/07/01.js @@ -1,13 +1,9 @@ -const expect = require('chai').expect; +describe('01 suspectData', () => { -const reduce = require('BASE/07-reduce.js'); + const suspectData = require('BASE/data/suspectData.js'); -describe('01 const total', () => { - - const total = reduce.__get__('total'); - - it('should add the numbers up', () => { - expect(total).to.equal(54); - }); + it('should be loaded in "data/suspectData.js"', () => { + expect(suspectData).to.be.defined; + }); }); diff --git a/tutorial/07/02.js b/tutorial/07/02.js index 34994c6..2799bc3 100644 --- a/tutorial/07/02.js +++ b/tutorial/07/02.js @@ -1,9 +1,13 @@ -describe('02 const averages', () => { +const expect = require('chai').expect; - const averages = reduce.__get__('averages'); +const reduce = require('BASE/07-reduce.js'); - it('should calculate the average of each class', () => { - expect(averages).to.deep.equal([57, 67, 70, 70, 71, 62, 67, 73, 62, 57]); - }); +describe('02 const total', () => { + + const total = reduce.__get__('total'); + + it('should add the numbers up', () => { + expect(total).to.equal(54); + }); }); diff --git a/tutorial/07/03.js b/tutorial/07/03.js index 6f01c95..8238e71 100644 --- a/tutorial/07/03.js +++ b/tutorial/07/03.js @@ -1,9 +1,9 @@ -describe('03 suspectData', () => { +describe('03 const averages', () => { - const suspectData = require('BASE/data/suspectData.js'); + const averages = reduce.__get__('averages'); - it('should be loaded in "data/courses2.js"', () => { - expect(suspectData).to.be.defined; + it('should calculate the average of each class', () => { + expect(averages).to.deep.equal([57, 67, 70, 70, 71, 62, 67, 73, 62, 57]); }); }); diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index 7c35e38..3cec45b 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -37,9 +37,7 @@ You may have noticed we've already used `reduce` to `flatten` our arrays. ```js Array.prototype.flatten = function() { - return this.reduce(function(a, b) { - return a.concat(b); - }, []); + return this.reduce((a, b) => a.concat(b), []); }; ``` @@ -47,50 +45,8 @@ With `flatten`, the initialValue was set to an empty array which each value was Do some practice with `reduce`, before you use it to narrow down a cheating suspect. - -+ Use `reduce` to sum the numbers in the `practice` array ++ load suspectData. We will come back to this after some practice; @test('07/01') -@action(open('07-reduce.js')) -@action(set( -``` -import courses from './data/courses2'; -// Array.reduce(fn(a, b), initialValue) - -const practice = [1, 1, 2, 3, 5, 8, 13, 21]; - -function add(a, b) { - return a + b; -} - -// total the numbers using a reduce function -const total = practice.reduce(::>); -``` -)) -@hint('with only numbers, the initialValue defaults to 0') -@hint('just call `reduce` with `add`') - -+ Not all reduce functions are so easy. `reduce` is a little more difficult to master. - -`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages. -@test('07/02') -@action(insert( -``` - -const averages = courses.map(function(course) { - const sum = course.students.reduce(function(total, student) { - ::> - - }); - return Math.round(sum / course.students.length, 0); -}); -``` -)) -@hint('set the initialValue to 0') -@hint('like this: `reduce(function () {}, 0)`') -@hint('return the sum of `student.score` and `total`') - -+ load suspectData -@test('07/03') @action(open('data/suspectData.js')) @action(set( ``` @@ -279,6 +235,46 @@ export default suspectData; ``` )) ++ Use `reduce` to sum the numbers in the `practice` array +@test('07/02') +@action(open('07-reduce.js')) +@action(set( +``` +import courses from './data/courses2'; +// Array.reduce(fn(a, b), initialValue) + +const practice = [1, 1, 2, 3, 5, 8, 13, 21]; + +function add(a, b) { + return a + b; +} + +// total the numbers using a reduce function +const total = practice.reduce(::>); +``` +)) +@hint('with only numbers, the initialValue defaults to 0') +@hint('just call `reduce` with `add`') + ++ Not all reduce functions are so easy. `reduce` is a little more difficult to master. + +`map` over each course and use `reduce` to calculate the class averages for each class. Set `averages` to the resulting array of all class averages. +@test('07/03') +@action(insert( +``` + +const averages = courses.map((course) => { + const sum = course.students.reduce((total, student) => { + ::> + + }); + return Math.round(sum / course.students.length, 0); +}); +``` +)) +@hint('set the initialValue to 0') +@hint('like this: `reduce(function () {}, 0)`') +@hint('return the sum of `student.score` and `total`') + `reduce` to an array of suspect scores from the `suspectData` we collected previously. @test('07/04') @@ -287,11 +283,9 @@ export default suspectData; ``` // [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...] -const suspectScores = suspectData.reduce(function(total, next) { +const suspectScores = suspectData.reduce((total, next) => { // see if suspect name has a list yet - const index = total.findIndex(function(suspect) { - return suspect.name === next.name; - }); + const index = total.findIndex((suspect) => suspect.name === next.name); if (index < 0) { total.push({ ::> @@ -323,7 +317,7 @@ const suspectScores = suspectData.reduce(function(total, next) { @action(insert( ``` -const suspectStats = suspectScores.map(function(suspect) { +const suspectStats = suspectScores.map((suspect) => { // calculate the total difference in scores from the averages const difference = suspect.scores.reduce(::>); @@ -352,7 +346,7 @@ function isCheater(suspect) { } // reduce down to a string of likely suspects -const likelySuspects = suspectStats.reduce(function(::>) {}, []); +const likelySuspects = suspectStats.reduce((::>) => {}, []); ``` )) @hint('use `.join(', ')`') From ad14461f7837cb6429b94a19f22611ccb52e6ffb Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 9 Aug 2016 21:13:09 -0700 Subject: [PATCH 37/46] change to.be.defined to to.not.be.undefined --- tutorial/00/01.js | 2 +- tutorial/00/02.js | 2 +- tutorial/00/03.js | 2 +- tutorial/01/01.js | 2 +- tutorial/01/02.js | 2 +- tutorial/01/03.js | 2 +- tutorial/01/04.js | 2 +- tutorial/02/01.js | 2 +- tutorial/02/02.js | 2 +- tutorial/02/05.js | 2 +- tutorial/03/01.js | 2 +- tutorial/03/02.js | 4 ++-- tutorial/03/03.js | 2 +- tutorial/03/04.js | 2 +- tutorial/03/05.js | 2 +- tutorial/03/06.js | 2 +- tutorial/04/01.js | 2 +- tutorial/05/01.js | 2 +- tutorial/06/01.js | 2 +- tutorial/07/01.js | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tutorial/00/01.js b/tutorial/00/01.js index d9cf444..a4a802c 100644 --- a/tutorial/00/01.js +++ b/tutorial/00/01.js @@ -9,7 +9,7 @@ describe('01 student data', () => { const students = require('BASE/data/students.js'); it('should be loaded in "data/students.js"', () => { - expect(students).to.be.defined; + expect(students).to.not.be.undefined; }); }); diff --git a/tutorial/00/02.js b/tutorial/00/02.js index 4adf979..0594a56 100644 --- a/tutorial/00/02.js +++ b/tutorial/00/02.js @@ -6,7 +6,7 @@ describe('02 const first', () => { const first = setup.__get__('first'); it('should exist', () => { - expect(first).to.be.defined; + expect(first).to.not.be.undefined; }); it('should be an object', () => { diff --git a/tutorial/00/03.js b/tutorial/00/03.js index 29a0b9b..5d038ff 100644 --- a/tutorial/00/03.js +++ b/tutorial/00/03.js @@ -4,7 +4,7 @@ describe('03 const myName', () => { const myName = setup.__get__('myName'); it('should exist', () => { - expect(myName).to.be.defined; + expect(myName).to.not.be.undefined; }); it('should be a string', () => { diff --git a/tutorial/01/01.js b/tutorial/01/01.js index 6075367..5c301cd 100644 --- a/tutorial/01/01.js +++ b/tutorial/01/01.js @@ -7,7 +7,7 @@ describe('01 function isAda', () => { const isAda = filter.__get__('isAda'); it('doesn\'t exist', () => { - expect(isAda).to.be.defined; + expect(isAda).to.not.be.undefined; }); it('isn\'t a Function', () => { diff --git a/tutorial/01/02.js b/tutorial/01/02.js index 3661925..0981fb3 100644 --- a/tutorial/01/02.js +++ b/tutorial/01/02.js @@ -3,7 +3,7 @@ describe('02 const myData', () => { const myData = filter.__get__('myData'); it('doesn\'t exist', () => { - expect(myData).to.be.defined; + expect(myData).to.not.be.undefined; }); it('doesn\'t output an array', () => { diff --git a/tutorial/01/03.js b/tutorial/01/03.js index 80d4c00..7074539 100644 --- a/tutorial/01/03.js +++ b/tutorial/01/03.js @@ -3,7 +3,7 @@ describe('03 function isGoodGrade', () => { const isGoodGrade = filter.__get__('isGoodGrade'); it('doesn\'t exist', () => { - expect(isGoodGrade).to.be.defined; + expect(isGoodGrade).to.not.be.undefined; }); it('isn\'t a Function', () => { diff --git a/tutorial/01/04.js b/tutorial/01/04.js index e70171b..dec5342 100644 --- a/tutorial/01/04.js +++ b/tutorial/01/04.js @@ -3,7 +3,7 @@ describe('04 const myBest', () => { const myBest = filter.__get__('myBest'); it('doesn\'t exist', () => { - expect(myBest).to.be.defined; + expect(myBest).to.not.be.undefined; }); it('doesn\'t output an array', () => { diff --git a/tutorial/02/01.js b/tutorial/02/01.js index 034f0f4..449fc4a 100644 --- a/tutorial/02/01.js +++ b/tutorial/02/01.js @@ -5,7 +5,7 @@ describe('01 myBest data', () => { const myBest = require('BASE/data/myBest.js'); it('should be loaded in "data/myBest.js"', () => { - expect(myBest).to.be.defined; + expect(myBest).to.not.be.undefined; }); }); diff --git a/tutorial/02/02.js b/tutorial/02/02.js index a7f9b89..c638bb8 100644 --- a/tutorial/02/02.js +++ b/tutorial/02/02.js @@ -4,7 +4,7 @@ const compareScore = sort.__get__('compareScore'); describe('02 function compareScore', () => { it('doesn\'t exist', () => { - expect(compareScore).to.be.defined; + expect(compareScore).to.not.be.undefined; }); it('isn\'t a Function', () => { diff --git a/tutorial/02/05.js b/tutorial/02/05.js index 0ca0893..8edb530 100644 --- a/tutorial/02/05.js +++ b/tutorial/02/05.js @@ -3,7 +3,7 @@ describe('05 const mySorted', () => { const mySorted = sort.__get__('mySorted'); it('doesn\'t exist', () => { - expect(mySorted).to.be.defined; + expect(mySorted).to.not.be.undefined; }); it('doesn\'t output an array', () => { diff --git a/tutorial/03/01.js b/tutorial/03/01.js index 19494f6..a2c68eb 100644 --- a/tutorial/03/01.js +++ b/tutorial/03/01.js @@ -5,7 +5,7 @@ describe('01 myCourses data', () => { const myCourses = require('BASE/data/myCourses.js'); it('should be loaded in "data/myCourses.js"', () => { - expect(myCourses).to.be.defined; + expect(myCourses).to.not.be.undefined; }); }); diff --git a/tutorial/03/02.js b/tutorial/03/02.js index 898ab0b..1e8a63a 100644 --- a/tutorial/03/02.js +++ b/tutorial/03/02.js @@ -5,7 +5,7 @@ describe('02 function changeGrade', () => { const changeGrade = map.__get__('changeGrade'); it('doesn\'t exist', () => { - expect(changeGrade).to.be.defined; + expect(changeGrade).to.not.be.undefined; }); it('isn\'t a function', () => { @@ -26,7 +26,7 @@ describe('02 function changeGrade', () => { const test = { grade: 'D' }; - expect(changeGrade(test)).to.be.defined; + expect(changeGrade(test)).to.not.be.undefined; }); it('should change grades from a D to an A', () => { diff --git a/tutorial/03/03.js b/tutorial/03/03.js index 9a6ccd6..39328e4 100644 --- a/tutorial/03/03.js +++ b/tutorial/03/03.js @@ -3,7 +3,7 @@ describe('03 const myChanged', () => { const myChanged = map.__get__('myChanged'); it('doesn\'t exist', () => { - expect(myChanged).to.be.defined; + expect(myChanged).to.not.be.undefined; }); it('isn\'t an array', () => { diff --git a/tutorial/03/04.js b/tutorial/03/04.js index c72f694..a69a2c1 100644 --- a/tutorial/03/04.js +++ b/tutorial/03/04.js @@ -3,7 +3,7 @@ describe('04 function increaseScore', () => { const increaseScore = map.__get__('increaseScore'); it('doesn\'t exist', () => { - expect(increaseScore).to.be.defined; + expect(increaseScore).to.not.be.undefined; }); it('should be a function', () => { diff --git a/tutorial/03/05.js b/tutorial/03/05.js index 0936352..abbdbcd 100644 --- a/tutorial/03/05.js +++ b/tutorial/03/05.js @@ -3,7 +3,7 @@ describe('05 function increaseScore', () => { const increaseScore = map.__get__('increaseScore'); it('doesn\'t exist', () => { - expect(increaseScore).to.be.defined; + expect(increaseScore).to.not.be.undefined; }); it('should be a function', () => { diff --git a/tutorial/03/06.js b/tutorial/03/06.js index 857a0c5..686c71c 100644 --- a/tutorial/03/06.js +++ b/tutorial/03/06.js @@ -3,7 +3,7 @@ describe('06 function getGrade', () => { const getGrade = map.__get__('getGrade'); it('doesn\'t exist', () => { - expect(getGrade).to.be.defined; + expect(getGrade).to.not.be.undefined; }); it('should be a function', () => { diff --git a/tutorial/04/01.js b/tutorial/04/01.js index 11a86b0..29ddeae 100644 --- a/tutorial/04/01.js +++ b/tutorial/04/01.js @@ -13,7 +13,7 @@ describe('01 myFixed data', () => { const myFixed = require('BASE/data/myFixed.js'); it('should be loaded in "data/myFixed.js"', () => { - expect(myFixed).to.be.defined; + expect(myFixed).to.not.be.undefined; }); }); diff --git a/tutorial/05/01.js b/tutorial/05/01.js index 3a09058..a000205 100644 --- a/tutorial/05/01.js +++ b/tutorial/05/01.js @@ -5,7 +5,7 @@ describe('01 courses2 data', () => { const courses = require('BASE/data/courses2.js'); it('should be loaded in "data/courses2.js"', () => { - expect(courses).to.be.defined; + expect(courses).to.not.be.undefined; }); }); diff --git a/tutorial/06/01.js b/tutorial/06/01.js index a9a076b..126d809 100644 --- a/tutorial/06/01.js +++ b/tutorial/06/01.js @@ -5,7 +5,7 @@ describe('01 load courses', () => { const courses = require('BASE/data/courses2.js'); it('should be loaded in "data/courses2.js"', () => { - expect(courses).to.be.defined; + expect(courses).to.not.be.undefined; }); }); diff --git a/tutorial/07/01.js b/tutorial/07/01.js index 3da82be..b9ed7a8 100644 --- a/tutorial/07/01.js +++ b/tutorial/07/01.js @@ -3,7 +3,7 @@ describe('01 suspectData', () => { const suspectData = require('BASE/data/suspectData.js'); it('should be loaded in "data/suspectData.js"', () => { - expect(suspectData).to.be.defined; + expect(suspectData).to.not.be.undefined; }); }); From b3f6875838d10e1bd54f20bcc405dbab8b764ec0 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 15 Aug 2016 10:32:19 -0700 Subject: [PATCH 38/46] prepare 0.6.0 release --- CHANGELOG.md | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e34552..05cb958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [0.6.0] - 2016-08-06 +## [0.6.0] - 2016-08-15 - update for mocha-coderoad v0.10 - removed loaders in favor of new syntax -- updated for es6 +- updated for es6 import/exports ## [0.5.0] - 2016-05-02 - remove "chapters" diff --git a/package.json b/package.json index 4150eee..cc87de6 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "dependencies": { "chai": "3.5.0", "chai-spies": "0.7.1", - "mocha": "^2.5.3", - "mocha-coderoad": "^0.8.1" + "mocha": "3.0.2", + "mocha-coderoad": "^0.10.0" }, "license": "MIT", "config": { From f5cd218434b0bbdcc9f24d8fe0bf81c187645e77 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Mon, 15 Aug 2016 10:52:57 -0700 Subject: [PATCH 39/46] repair syntax highlighting --- package.json | 2 +- tutorial/01/filter.md | 8 ++++---- tutorial/05/find.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index cc87de6..5be54e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.6.0", + "version": "0.6.1", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index 7f2323e..a794154 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -7,7 +7,7 @@ It would be great if you could `filter` the scores that your parents will see. `filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below: -``` +```js function isA(x) { return x === 'a'; } @@ -16,7 +16,7 @@ function isA(x) { Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). -``` +```js const list = ['a', 'b']; list.filter(isA); @@ -28,7 +28,7 @@ list.filter(isA); If your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below. -``` +```js function isB(x) { return x.item === 'b' } @@ -42,7 +42,7 @@ Where were we? Back to filtering our grades. There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: -``` +```js console.log(students[0]); //> { course: 'Web Security', // instructor: 'Sue Denim', diff --git a/tutorial/05/find.md b/tutorial/05/find.md index cb1d32d..a0d040a 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -7,7 +7,7 @@ You quickly put together a list of other students in class. If someone changed y `find` works similar to `filter`, but returns only the first match. -``` +```js const data = [1, 2, 3, 4, 5, 6]; function isEven(num) { From 16e014ab821b1b74a810f35f60b26ca4e63eb4da Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 16 Aug 2016 11:54:34 -0700 Subject: [PATCH 40/46] change relative imports to require to avoid import bug --- README.md | 14 +++++--------- coderoad.json | 22 +++++++++++----------- package.json | 4 ++-- tutorial/00/setup.md | 2 +- tutorial/01/filter.md | 2 +- tutorial/02/sort.md | 2 +- tutorial/03/map.md | 11 ++++++----- tutorial/04/forEach.md | 2 +- tutorial/05/find.md | 2 +- tutorial/06/concat.md | 2 +- tutorial/07/reduce.md | 2 +- tutorial/tutorial.md | 2 -- 12 files changed, 31 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 339684c..f973a42 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,6 @@ Keywords: javascript, functional Length: 1-2 hours - - - - ## CodeRoad CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. Learn more at [CodeRoad.io](http://coderoad.io). @@ -67,7 +63,7 @@ It would be great if you could `filter` the scores that your parents will see. `filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below: -``` +```js function isA(x) { return x === 'a'; } @@ -76,7 +72,7 @@ function isA(x) { Like all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). -``` +```js const list = ['a', 'b']; list.filter(isA); @@ -88,7 +84,7 @@ list.filter(isA); If your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below. -``` +```js function isB(x) { return x.item === 'b' } @@ -102,7 +98,7 @@ Where were we? Back to filtering our grades. There's too much student data in the computer system. We'll have to sort through it. Have a look at an example below: -``` +```js console.log(students[0]); //> { course: 'Web Security', // instructor: 'Sue Denim', @@ -304,7 +300,7 @@ You quickly put together a list of other students in class. If someone changed y `find` works similar to `filter`, but returns only the first match. -``` +```js const data = [1, 2, 3, 4, 5, 6]; function isEven(num) { diff --git a/coderoad.json b/coderoad.json index 525c082..d01e6b2 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,7 +1,7 @@ { "info": { "title": "Functional School", - "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours\n\n\n\n" + "description": "A trip through functional programming in Javascript using common built-in Javascript array methods such as `map` & `reduce`.\n\nBy the end, you should have an understanding of how to use array methods to manipulate semi-complex data.\n\nLevel: Intermediate\nKeywords: javascript, functional\nLength: 1-2 hours" }, "pages": [ { @@ -25,7 +25,7 @@ ], "actions": [ "open('00-setup.js')", - "set('// Welcome to CodeRoad!\nimport students from './data/students';\n\nvar first = ::>\n')" + "set('// Welcome to CodeRoad!\nconst students = require('./data/students').default;\n\nvar first = ::>\n')" ], "hints": [ "Get the first item in students using the array index", @@ -64,7 +64,7 @@ }, { "title": "Filter", - "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```\nconst list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```\nfunction isB(x) {\n return x.item === 'b'\n}\n\nconst list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", + "description": "Array -> Array of items that match a condition\n\nYou've hacked into the school's computer system, and just in time. The grades are in, but you're not too proud of your performance. That's okay, you have a plan: you're going to create a fake report card.\n\nIt would be great if you could `filter` the scores that your parents will see.\n\n`filter` takes a matching condition function and only returns items that result in true. As an example, look at `isA` below:\n\n```js\nfunction isA(x) {\n return x === 'a';\n}\n```\n\n\nLike all of the methods in this chapter, `filter` is already part of the `Array.prototype`, so you can run it following any array. Each item in the array is passed into the params of the condition function, one by one. [Learn more](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n```js\nconst list = ['a', 'b'];\nlist.filter(isA);\n\n// if isA(list[0]), add to output array\n// if isA(list[1]), add to output array\n//\n//> ['a']\n```\n\nIf your data was composed of objects, we could use dot notation to find matches. Checkout `isB` below.\n\n```js\nfunction isB(x) {\n return x.item === 'b'\n}\n\nconst list = [{item: 'a'}, {item: 'b'}];\nlist.filter(isB);\n//> [{item: 'b'}]\n```\n\nWhere were we? Back to filtering our grades.\n\nThere's too much student data in the computer system. We'll have to sort through it. Have a look at an example below:\n\n```js\nconsole.log(students[0]);\n//> { course: 'Web Security',\n// instructor: 'Sue Denim',\n// name: 'Rebecca Heineman',\n// score: 93,\n// grade: 'A' }\n```", "tasks": [ { "description": "Write a filter condition function called `isAda` that returns true only if the name matches your name: \"Ada Lovelace\".", @@ -73,7 +73,7 @@ ], "actions": [ "open('01-filter.js')", - "set('import students from './data/students';\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" + "set('const students = require('./data/students').default;\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" ], "hints": [ "Some tasks have hints", @@ -141,7 +141,7 @@ ], "actions": [ "open('02-sort.js')", - "set('import myBest from './data/myBest';\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + "set('const myBest = require('./data/myBest').default;\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" ] }, { @@ -198,7 +198,7 @@ ], "actions": [ "open('03-map.js')", - "set('import myCourses from './data/myCourses';\n// Array.map(fn)\n\n/*\n change any `course.grade`'s into an 'A'\n\n example:\n changeGrade({ grade: 'F' }) === { grade: 'A' };\n*/\nfunction changeGrade(course) {\n ::>\n}\n\n')" + "set('const myCourses = require('./data/myCourses').default;\n// Array.map(fn)\n\n/*\n * change any the `course.grade` into an 'A'\n *\n * for example:\n * changeGrade({ grade: 'F' }) === { grade: 'A' };\n*/\n\nfunction changeGrade(course) {\n ::>\n}\n\n')" ], "hints": [ "give `changeGrade` a parameter, call it \"course\"", @@ -294,7 +294,7 @@ ], "actions": [ "open('04-forEach.js')", - "set('import myFixed from './data/myFixed';\n// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" + "set('const myFixed = require('./data/myFixed').default;\n// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" ], "hints": [ "call `forEach` with `logCourse`" @@ -340,7 +340,7 @@ }, { "title": "find", - "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```\nconst data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", + "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```js\nconst data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", "tasks": [ { "description": "load \"students\" data", @@ -359,7 +359,7 @@ ], "actions": [ "open('05-find.js')", - "set('import courses from './data/myCourses2';\n// Array.find(fn)\n\n// filter for the course title matching \"Web Security\"\nconst myClass = courses.filter(::>);\n')" + "set('const courses = require('./data/myCourses2');\n// Array.find(fn)\n\n// filter for the course title matching \"Web Security\"\nconst myClass = courses.filter(::>);\n')" ], "hints": [ "create a `filter` function that takes a param `course`", @@ -443,7 +443,7 @@ ], "actions": [ "open('06-concat.js')", - "set('import courses from './data/courses2';\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n')", + "set('const courses = require('./data/courses2').default;\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n')", "insert('\nconst numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nconst flattenedArray = numberedList::>;\n')" ], "hints": [ @@ -517,7 +517,7 @@ ], "actions": [ "open('07-reduce.js')", - "set('import courses from './data/courses2';\n// Array.reduce(fn(a, b), initialValue)\n\nconst practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nconst total = practice.reduce(::>);\n')" + "set('const courses = require('./data/courses2');\n// Array.reduce(fn(a, b), initialValue)\n\nconst practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nconst total = practice.reduce(::>);\n')" ], "hints": [ "with only numbers, the initialValue defaults to 0", diff --git a/package.json b/package.json index 5be54e9..ce9f18d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "0.6.1", + "version": "1.0.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ @@ -22,7 +22,7 @@ "url": "https://github.com/coderoad/coderoad-functional-school/issues" }, "engines": { - "node" : ">=0.10.3" + "node" : ">=4.0.0" }, "dependencies": { "chai": "3.5.0", diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index 31572d3..6bcdd79 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -1002,7 +1002,7 @@ export default students; @action(set( ``` // Welcome to CodeRoad! -import students from './data/students'; +const students = require('./data/students').default; var first = ::> ``` diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index a794154..5915d8a 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -56,7 +56,7 @@ console.log(students[0]); @action(open('01-filter.js')) @action(set( ``` -import students from './data/students'; +const students = require('./data/students').default; // Array.filter(fn) function isAda(student) { diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index 45b6a51..e8ca1f3 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -89,7 +89,7 @@ export default myBest; @action(open('02-sort.js')) @action(set( ``` -import myBest from './data/myBest'; +const myBest = require('./data/myBest').default; // Array.sort(fn) function compareScore(a, b) { diff --git a/tutorial/03/map.md b/tutorial/03/map.md index 8e0396b..1b49fcf 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -131,15 +131,16 @@ export default myCourses; @action(open('03-map.js')) @action(set( ``` -import myCourses from './data/myCourses'; +const myCourses = require('./data/myCourses').default; // Array.map(fn) /* - change any `course.grade`'s into an 'A' - - example: - changeGrade({ grade: 'F' }) === { grade: 'A' }; + * change any the `course.grade` into an 'A' + * + * for example: + * changeGrade({ grade: 'F' }) === { grade: 'A' }; */ + function changeGrade(course) { ::> } diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index d853d5b..7c138fe 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -161,7 +161,7 @@ export default myFixed; @action(open('04-forEach.js')) @action(set( ``` -import myFixed from './data/myFixed'; +const myFixed = require('./data/myFixed').default; // Array.forEach(fn) function logCourse(course) { diff --git a/tutorial/05/find.md b/tutorial/05/find.md index a0d040a..048eaf2 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -1000,7 +1000,7 @@ export default myCourses; @action(open('05-find.js')) @action(set( ``` -import courses from './data/myCourses2'; +const courses = require('./data/myCourses2'); // Array.find(fn) // filter for the course title matching "Web Security" diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index 442f7cc..211a4bf 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -790,7 +790,7 @@ export default courses; @action(open('06-concat.js')) @action(set( ``` -import courses from './data/courses2'; +const courses = require('./data/courses2').default; // Array.concat(any) // Array.prototype can be used to create new Array methods diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index 3cec45b..8d3e518 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -240,7 +240,7 @@ export default suspectData; @action(open('07-reduce.js')) @action(set( ``` -import courses from './data/courses2'; +const courses = require('./data/courses2'); // Array.reduce(fn(a, b), initialValue) const practice = [1, 1, 2, 3, 5, 8, 13, 21]; diff --git a/tutorial/tutorial.md b/tutorial/tutorial.md index 4447c97..5c89746 100644 --- a/tutorial/tutorial.md +++ b/tutorial/tutorial.md @@ -16,5 +16,3 @@ Length: 1-2 hours @import('05/find') @import('06/concat') @import('07/reduce') - - From 059423119718ec08e937c7afd2b8975d7f337307 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 16 Aug 2016 18:16:21 -0700 Subject: [PATCH 41/46] use "writeFromFile" in atom-coderoad@0.12 --- CHANGELOG.md | 3 + coderoad.json | 34 +- tutorial/00/setup.md | 972 +--------------------------------------- tutorial/02/sort.md | 53 +-- tutorial/03/map.md | 67 +-- tutorial/04/forEach.md | 69 +-- tutorial/05/find.md | 969 +-------------------------------------- tutorial/06/concat.md | 687 +--------------------------- tutorial/06/courses2.js | 682 ++++++++++++++++++++++++++++ tutorial/07/reduce.md | 187 +------- 10 files changed, 714 insertions(+), 3009 deletions(-) create mode 100644 tutorial/06/courses2.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 05cb958..71c9a10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.7.0] - 2016-08-16 +- use new "writeFromFile" action in atom-coderoad@0.12 + ## [0.6.0] - 2016-08-15 - update for mocha-coderoad v0.10 - removed loaders in favor of new syntax diff --git a/coderoad.json b/coderoad.json index d01e6b2..fcca353 100644 --- a/coderoad.json +++ b/coderoad.json @@ -9,13 +9,12 @@ "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", "tasks": [ { - "description": "Load the student data into \"students.js\"", + "description": "Look in \"data/students.js\". This is the data we will be working with. Run save to continue.\n@open('data/students.js')", "tests": [ "00/01" ], "actions": [ - "open('data/students.js')", - "set('const students = [{\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ada Lovelace\",\n\tscore: 91,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Albert Gonzalez\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Brian Kernaghan\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 78,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Donald Knuth\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Grace Hopper\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Hack Kerr\",\n\tscore: 85,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"James Gosling\",\n\tscore: 30,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ken Thompson\",\n\tscore: 30,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Kevin Mitnick\",\n\tscore: 72,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Linus Torvalds\",\n\tscore: 34,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Niklaus Wirth\",\n\tscore: 75,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Rebecca Heineman\",\n\tscore: 71,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 54,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Xiao Tian\",\n\tscore: 67,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ying Cracker\",\n\tscore: 57,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Albert Gonzalez\",\n\tscore: 37,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Brian Kernaghan\",\n\tscore: 76,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 53,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Donald Knuth\",\n\tscore: 34,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Grace Hopper\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Hack Kerr\",\n\tscore: 86,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"James Gosling\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ken Thompson\",\n\tscore: 48,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Kevin Mitnick\",\n\tscore: 52,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Linus Torvalds\",\n\tscore: 90,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Niklaus Wirth\",\n\tscore: 78,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Rebecca Heineman\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Xiao Tian\",\n\tscore: 45,\n\tgrade: \"F\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ying Cracker\",\n\tscore: 77,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Ada Lovelace\",\n\tscore: 61,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Albert Gonzalez\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Brian Kernaghan\",\n\tscore: 47,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Donald Knuth\",\n\tscore: 80,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Grace Hopper\",\n\tscore: 80,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Hack Kerr\",\n\tscore: 92,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"James Gosling\",\n\tscore: 97,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Ken Thompson\",\n\tscore: 64,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Kevin Mitnick\",\n\tscore: 47,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Linus Torvalds\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Niklaus Wirth\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Rebecca Heineman\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 98,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Xiao Tian\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tname: \"Ying Cracker\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ada Lovelace\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Albert Gonzalez\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Brian Kernaghan\",\n\tscore: 92,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 34,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Donald Knuth\",\n\tscore: 44,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Grace Hopper\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Hack Kerr\",\n\tscore: 75,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"James Gosling\",\n\tscore: 95,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ken Thompson\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Kevin Mitnick\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Linus Torvalds\",\n\tscore: 57,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Niklaus Wirth\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Rebecca Heineman\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Xiao Tian\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ying Cracker\",\n\tscore: 42,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ada Lovelace\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Albert Gonzalez\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Brian Kernaghan\",\n\tscore: 71,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 66,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Donald Knuth\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Grace Hopper\",\n\tscore: 99,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Hack Kerr\",\n\tscore: 83,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"James Gosling\",\n\tscore: 99,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ken Thompson\",\n\tscore: 65,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Kevin Mitnick\",\n\tscore: 47,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Linus Torvalds\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Niklaus Wirth\",\n\tscore: 50,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Rebecca Heineman\",\n\tscore: 33,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 51,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Xiao Tian\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ying Cracker\",\n\tscore: 60,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Ada Lovelace\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Albert Gonzalez\",\n\tscore: 67,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Brian Kernaghan\",\n\tscore: 66,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Donald Knuth\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Grace Hopper\",\n\tscore: 66,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Hack Kerr\",\n\tscore: 96,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"James Gosling\",\n\tscore: 83,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Ken Thompson\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Kevin Mitnick\",\n\tscore: 75,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Linus Torvalds\",\n\tscore: 63,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Niklaus Wirth\",\n\tscore: 75,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Rebecca Heineman\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 41,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Xiao Tian\",\n\tscore: 49,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tname: \"Ying Cracker\",\n\tscore: 96,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ada Lovelace\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Albert Gonzalez\",\n\tscore: 39,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Brian Kernaghan\",\n\tscore: 69,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 54,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Donald Knuth\",\n\tscore: 83,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Grace Hopper\",\n\tscore: 31,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Hack Kerr\",\n\tscore: 94,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"James Gosling\",\n\tscore: 35,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ken Thompson\",\n\tscore: 67,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Kevin Mitnick\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Linus Torvalds\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Niklaus Wirth\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Rebecca Heineman\",\n\tscore: 92,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 48,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Xiao Tian\",\n\tscore: 80,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ying Cracker\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ada Lovelace\",\n\tscore: 82,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Albert Gonzalez\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Brian Kernaghan\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 38,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Donald Knuth\",\n\tscore: 86,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Grace Hopper\",\n\tscore: 42,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Hack Kerr\",\n\tscore: 87,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"James Gosling\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ken Thompson\",\n\tscore: 86,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Kevin Mitnick\",\n\tscore: 41,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Linus Torvalds\",\n\tscore: 76,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Niklaus Wirth\",\n\tscore: 78,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Rebecca Heineman\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 74,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Xiao Tian\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ying Cracker\",\n\tscore: 95,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Albert Gonzalez\",\n\tscore: 56,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Brian Kernaghan\",\n\tscore: 58,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 38,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Donald Knuth\",\n\tscore: 85,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Grace Hopper\",\n\tscore: 53,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Hack Kerr\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"James Gosling\",\n\tscore: 42,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ken Thompson\",\n\tscore: 87,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Kevin Mitnick\",\n\tscore: 40,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Linus Torvalds\",\n\tscore: 91,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Niklaus Wirth\",\n\tscore: 51,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Rebecca Heineman\",\n\tscore: 79,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 37,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Xiao Tian\",\n\tscore: 84,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ying Cracker\",\n\tscore: 45,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Ada Lovelace\",\n\tscore: 65,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Albert Gonzalez\",\n\tscore: 52,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Brian Kernaghan\",\n\tscore: 61,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Danielle Bunten Berry\",\n\tscore: 59,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Donald Knuth\",\n\tscore: 89,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Grace Hopper\",\n\tscore: 40,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Hack Kerr\",\n\tscore: 102,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"James Gosling\",\n\tscore: 39,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Ken Thompson\",\n\tscore: 83,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Kevin Mitnick\",\n\tscore: 37,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Linus Torvalds\",\n\tscore: 65,\n\tgrade: \"D\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Niklaus Wirth\",\n\tscore: 36,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Rebecca Heineman\",\n\tscore: 32,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Tim Berners-Lee\",\n\tscore: 70,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Xiao Tian\",\n\tscore: 52,\n\tgrade: \"F\"\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tname: \"Ying Cracker\",\n\tscore: 62,\n\tgrade: \"D\"\n}];\nexport default students;\n')" + "writeFromFile('data/students.js', '00/data.js')" ] }, { @@ -125,13 +124,12 @@ "description": "Array -> sorted Array\n\nYour grades are filtered down to your name and good scores - but wouldn't it be better if your best grades were displayed first, at the top? Besides, your parents rarely read anything through.\n\nYou can use the array method `sort` to arrange your data. Let's see how it works.\n\n```js\n['c', 'b', 'a'].sort();\n//> ['a', 'b', 'c']\n\n[3, 2, 1].sort();\n//> [1, 2, 3]\n```\n\nBut what about sorting scores inside of an object?\n\n```js\n[{a: 3}, {a: 1}, {a: 2}].sort();\n//> [{a: 3}, {a: 1}, {a: 2}]\n```\n\nThat didn't work. Instead, you can write a custom `compareScore` function.\n\nA sort function takes two params, and compares the first to the second. It should return values saying where the second value should go in the array:\n\n * -1 : sort to a lower index (front)\n * 1 : sort to a higher index (back)\n * 0 : stay the same\n\nAlright, now time to sort your best grades to the top.\n\nFirst you'll need to write a sort condition function called `compareScore`.", "tasks": [ { - "description": "load `myBest`", + "description": "look at the data we will work with next: `myBest`. Save to continue.\n@open('data/myBest.js')", "tests": [ "02/01" ], "actions": [ - "open('data/myBest.js')", - "set('const myBest = [{\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tname: \"Ada Lovelace\",\n\tscore: 91,\n\tgrade: \"A\"\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tname: \"Ada Lovelace\",\n\tscore: 81,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tname: \"Ada Lovelace\",\n\tscore: 73,\n\tgrade: \"C\"\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tname: \"Ada Lovelace\",\n\tscore: 93,\n\tgrade: \"A\"\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tname: \"Ada Lovelace\",\n\tscore: 82,\n\tgrade: \"B\"\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tname: \"Ada Lovelace\",\n\tscore: 88,\n\tgrade: \"B\"\n}];\nexport default myBest;\n')" + "writeFromFile('data/myBest.js', '02/myBest.js')" ] }, { @@ -187,8 +185,8 @@ "03/01" ], "actions": [ - "open('data/myCourses.js')", - "set('const myCourses = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:91,\n grade:\"A\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:61,\n grade:\"D\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:81,\n grade:\"B\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:58,\n grade:\"F\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:82,\n grade:\"B\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:88,\n grade:\"B\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:65,\n grade:\"D\"\n}];\nexport default myCourses;\n')" + "writeFromFile('data/myCourses.js', '03/myCourses.js')", + "open('data/myCourses.js')" ] }, { @@ -278,13 +276,13 @@ "description": "Array -> run a function for each item\n\nYou've updated your grades, but they're still in an array. It's time to loop over them and log them to the console.\n\nTo open the console, go to *View* > *Developer* > *Toggle Developer Tools*. Or press *cmd+opt+I* on Mac, *ctrl+alt+I* on Windows.\n\n`forEach` has a lot in common with `map`, but there is a big difference. Understanding that difference is important for grasping the difference between:\n\n * **functional** & **imperative** programming\n * **pure** & **impure** functions\n\nKnow it or not, you're probably already used to \"imperative\" programming.\n\n> **Imperative** programming describes the order of actions\n\nImperative code tells the computer what to do, step by step.\n\n```js\nlet x = 1; // make a variable\nx = x + 1; // add one\nx = x + 1; // add another\nconsole.log(x);\n//> 3\n```\n\n> **Functional** programming describes the data transformation\n\nFunctional programming is a lot like writing math equations. As in math, 1 + 1 always equals 2.\n\nIn the same way, a **pure** function will always have the same result from a given input. Input 1 -> output 2. Every time.\n\n```js\n// a pure function\nfunction addOne(x) {\n return x + 1;\n}\naddOne(1)\n//> 2\naddOne(1)\n//> 2\n```\n\nA function is \"pure\" if it doesn't change anything outside of its scope. Pure functions are easy to test, reuse and reason about. In other words, they make your job easier.\n\nOn the other hand, **impure** functions are less predictable. The result may be different if you call it at a later time.\n\n```js\nlet y = 1;\n// impure function\nfunction increment(x) {\n y += x;\n return y;\n}\nincrement(1)\n//> 2\nincrement(1)\n//> 3\n```\n\nIt's good practice to ensure your `map` functions remain pure.\n\nBut `forEach` can be a little more dangerous. Why? Let's have a look.\n\n```js\n[1, 2, 3].map(addOne);\n//> [2, 3, 4]\n\n[1, 2, 3].forEach(addOne);\n//> undefined\n```\n\nWhat? `undefined`? `forEach` runs a function on each item in the array, and doesn't care what the function returns. Functions called by `forEach` must make changes, called **side effects**, to even be noticed.\n\n```js\n// impure function, changes log\nfunction addOneToLog(x) {\n console.log(x);\n}\n\n[1, 2, 3].forEach(addOneToLog);\n//> 2\n//> 3\n//> 4\n```\n\nNow that we see how `forEach` works, let's use it to make calls to the `console`.", "tasks": [ { - "description": "load \"myFixed\"", + "description": "checkout the data we'll use next: \"myFixed\". Save to continue.", "tests": [ "04/01" ], "actions": [ - "open('data/myFixed.js')", - "set('const myFixed = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Ada Lovelace\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Ada Lovelace\",\n score:93,\n grade:\"A\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Ada Lovelace\",\n score:85,\n grade:\"B\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Ada Lovelace\",\n score:70,\n grade:\"C\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Ada Lovelace\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Ada Lovelace\",\n score:95,\n grade:\"A\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Ada Lovelace\",\n score:77,\n grade:\"C\"\n}];\nexport default myFixed;\n')" + "writeFromFile('data/myFixed.js', '04/myFixed.js')", + "open('data/myFixed.js')" ] }, { @@ -343,13 +341,13 @@ "description": "Array -> first element that matches a condition\n\nSomehow your name has disappeared from the computer system. We'll have to `find` a way to get it back.\n\nYou quickly put together a list of other students in class. If someone changed your name, it'll be the name that is not in that list.\n\n`find` works similar to `filter`, but returns only the first match.\n\n```js\nconst data = [1, 2, 3, 4, 5, 6];\n\nfunction isEven(num) {\n return num % 2 === 0;\n}\n\n// returns all matching data to a condition\ndata.filter(isEven);\n//> [2, 4, 6]\n\n// returns the first match\ndata.find(isEven);\n//> [2]\n```\n\nFind is great for performantly matching unique values in data, such as an \"id\", or in our case: a name.", "tasks": [ { - "description": "load \"students\" data", + "description": "load \"students\" data. Save to continue.", "tests": [ "05/01" ], "actions": [ - "open('data/myCourses2.js')", - "set('const myCourses = [{\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"!f\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Albert Gonzalez\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Brian Kernaghan\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Danielle Bunten Berry\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Grace Hopper\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Hack Kerr\",\n score: 85,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"James Gosling\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ken Thompson\",\n score: 30,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Kevin Mitnick\",\n score: 72,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Linus Torvalds\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Rebecca Heineman\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Tim Berners-Lee\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Xiao Tian\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Relational Databases\",\n instructor: \"Sean Quentin Lewis\",\n name: \"Ying Cracker\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"in\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Albert Gonzalez\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Brian Kernaghan\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Danielle Bunten Berry\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Donald Knuth\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Grace Hopper\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Hack Kerr\",\n score: 86,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"James Gosling\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ken Thompson\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Kevin Mitnick\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Linus Torvalds\",\n score: 90,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Rebecca Heineman\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Tim Berners-Lee\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Xiao Tian\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"3D Computer Graphics\",\n instructor: \"G.L. Webb\",\n name: \"Ying Cracker\",\n score: 77,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"dt\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Albert Gonzalez\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Brian Kernaghan\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Danielle Bunten Berry\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Donald Knuth\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Grace Hopper\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Hack Kerr\",\n score: 92,\n grade: \"C\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"James Gosling\",\n score: 97,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ken Thompson\",\n score: 64,\n grade: \"D\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Linus Torvalds\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Niklaus Wirth\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Rebecca Heineman\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Tim Berners-Lee\",\n score: 98,\n grade: \"A\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Xiao Tian\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Front End Web Development\",\n instructor: \"Moe Zaick\",\n name: \"Ying Cracker\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Donald Knuth\",\n score: 44,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Albert Gonzalez\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Brian Kernaghan\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Danielle Bunten Berry\",\n score: 34,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"he\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Grace Hopper\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Hack Kerr\",\n score: 75,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"James Gosling\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ken Thompson\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Kevin Mitnick\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Linus Torvalds\",\n score: 57,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Niklaus Wirth\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Rebecca Heineman\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Tim Berners-Lee\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Web Security\",\n instructor: \"Sue Denim\",\n name: \"Ying Cracker\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"be\",\n score: 73,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Albert Gonzalez\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Brian Kernaghan\",\n score: 71,\n grade: \"C\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Danielle Bunten Berry\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Donald Knuth\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Grace Hopper\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Hack Kerr\",\n score: 83,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"James Gosling\",\n score: 99,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ken Thompson\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Kevin Mitnick\",\n score: 47,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Linus Torvalds\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Niklaus Wirth\",\n score: 50,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Rebecca Heineman\",\n score: 33,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Tim Berners-Lee\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Xiao Tian\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Javascript Fundamentals\",\n instructor: \"Jay Kweerie\",\n name: \"Ying Cracker\",\n score: 60,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"st\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Albert Gonzalez\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Brian Kernaghan\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Danielle Bunten Berry\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Donald Knuth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Grace Hopper\",\n score: 66,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Hack Kerr\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"James Gosling\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ken Thompson\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Kevin Mitnick\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Linus Torvalds\",\n score: 63,\n grade: \"D\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Niklaus Wirth\",\n score: 75,\n grade: \"C\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Rebecca Heineman\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Tim Berners-Lee\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Xiao Tian\",\n score: 49,\n grade: \"F\"\n}, {\n title: \"Data Science\",\n instructor: \"Ford Fulkerson\",\n name: \"Ying Cracker\",\n score: 96,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"re\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Albert Gonzalez\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Brian Kernaghan\",\n score: 69,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Danielle Bunten Berry\",\n score: 54,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Donald Knuth\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Grace Hopper\",\n score: 31,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Hack Kerr\",\n score: 94,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"James Gosling\",\n score: 35,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ken Thompson\",\n score: 67,\n grade: \"D\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Kevin Mitnick\",\n score: 81,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Linus Torvalds\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Niklaus Wirth\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Rebecca Heineman\",\n score: 92,\n grade: \"A\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Tim Berners-Lee\",\n score: 48,\n grade: \"F\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Xiao Tian\",\n score: 80,\n grade: \"B\"\n}, {\n title: \"Algorithm Design\",\n instructor: \"Gale Shapely\",\n name: \"Ying Cracker\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"ve\",\n score: 82,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Albert Gonzalez\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Brian Kernaghan\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Donald Knuth\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Grace Hopper\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Hack Kerr\",\n score: 87,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"James Gosling\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ken Thompson\",\n score: 86,\n grade: \"B\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Kevin Mitnick\",\n score: 41,\n grade: \"F\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Linus Torvalds\",\n score: 76,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Niklaus Wirth\",\n score: 78,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Rebecca Heineman\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Tim Berners-Lee\",\n score: 74,\n grade: \"C\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Xiao Tian\",\n score: 93,\n grade: \"A\"\n}, {\n title: \"Data Abstraction\",\n instructor: \"Aster Ricks\",\n name: \"Ying Cracker\",\n score: 95,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"ng\",\n score: 88,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Albert Gonzalez\",\n score: 56,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Brian Kernaghan\",\n score: 58,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Danielle Bunten Berry\",\n score: 38,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Donald Knuth\",\n score: 85,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Grace Hopper\",\n score: 53,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Hack Kerr\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"James Gosling\",\n score: 42,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ken Thompson\",\n score: 87,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Kevin Mitnick\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Linus Torvalds\",\n score: 91,\n grade: \"A\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Niklaus Wirth\",\n score: 51,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Rebecca Heineman\",\n score: 79,\n grade: \"C\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Tim Berners-Lee\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Xiao Tian\",\n score: 84,\n grade: \"B\"\n}, {\n title: \"Data Structures\",\n instructor: \"Brodal Q.\",\n name: \"Ying Cracker\",\n score: 45,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"e!\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Albert Gonzalez\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Brian Kernaghan\",\n score: 61,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Danielle Bunten Berry\",\n score: 59,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Donald Knuth\",\n score: 89,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Grace Hopper\",\n score: 40,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Hack Kerr\",\n score: 102,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"James Gosling\",\n score: 39,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ken Thompson\",\n score: 83,\n grade: \"B\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Kevin Mitnick\",\n score: 37,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Linus Torvalds\",\n score: 65,\n grade: \"D\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Niklaus Wirth\",\n score: 36,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Rebecca Heineman\",\n score: 32,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Tim Berners-Lee\",\n score: 70,\n grade: \"C\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Xiao Tian\",\n score: 52,\n grade: \"F\"\n}, {\n title: \"Networks\",\n instructor: \"Van Emde Boas\",\n name: \"Ying Cracker\",\n score: 62,\n grade: \"D\"\n}];\nexport default myCourses;\n')" + "writeFromFile('data/myCourses2.js', '05/courses.js')", + "open('data/myCourses2.js')" ] }, { @@ -432,8 +430,8 @@ "06/01" ], "actions": [ - "open('data/courses2.js')", - "set('const courses = [{\n\ttitle: \"Relational Databases\",\n\tinstructor: \"Sean Quentin Lewis\",\n\tstudents: [{\n\t\tname: \"!f\",\n\t\tscore: 61,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 78,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 85,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 30,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 30,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 72,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 34,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 75,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 71,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 54,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 67,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 57,\n\t\tgrade: \"F\"\n\t}]\n}, {\n\ttitle: \"3D Computer Graphics\",\n\tinstructor: \"G.L. Webb\",\n\tstudents: [{\n\t\tname: \"in\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 37,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 76,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 53,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 34,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 86,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 48,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 90,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 78,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 73,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 45,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 77,\n\t\tgrade: \"C\"\n\t}]\n}, {\n\ttitle: \"Front End Web Development\",\n\tinstructor: \"Moe Zaick\",\n\tstudents: [{\n\t\tname: \"dt\",\n\t\tscore: 31,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 73,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 47,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 80,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 80,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 92,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 97,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 64,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 47,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 98,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 73,\n\t\tgrade: \"C\"\n\t}]\n}, {\n\ttitle: \"Web Security\",\n\tinstructor: \"Sue Denim\",\n\tstudents: [{\n\t\tname: \"he\",\n\t\tscore: 51,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 92,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 34,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 44,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 81,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 75,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 95,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 57,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 88,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 42,\n\t\tgrade: \"F\"\n\t}]\n}, {\n\ttitle: \"Javascript Fundamentals\",\n\tinstructor: \"Jay Kweerie\",\n\tstudents: [{\n\t\tname: \"be\",\n\t\tscore: 43,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 71,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 66,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 99,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 83,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 99,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 65,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 47,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 50,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 33,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 51,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 60,\n\t\tgrade: \"D\"\n\t}]\n}, {\n\ttitle: \"Data Science\",\n\tinstructor: \"Ford Fulkerson\",\n\tstudents: [{\n\t\tname: \"st\",\n\t\tscore: 28,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 67,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 66,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 66,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 96,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 83,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 75,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 63,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 75,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 41,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 49,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 96,\n\t\tgrade: \"A\"\n\t}]\n}, {\n\ttitle: \"Algorithm Design\",\n\tinstructor: \"Gale Shapely\",\n\tstudents: [{\n\t\tname: \"re\",\n\t\tscore: 63,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 39,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 69,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 54,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 83,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 31,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 94,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 67,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 81,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 92,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 48,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 80,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}]\n}, {\n\ttitle: \"Data Abstraction\",\n\tinstructor: \"Aster Ricks\",\n\tstudents: [{\n\t\tname: \"ve\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 38,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 86,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 42,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 87,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 86,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 41,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 76,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 78,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 74,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 93,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 95,\n\t\tgrade: \"A\"\n\t}]\n}, {\n\ttitle: \"Data Structures\",\n\tinstructor: \"Brodal Q.\",\n\tstudents: [{\n\t\tname: \"ng\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 56,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 58,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 38,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 85,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 53,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 42,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 87,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 40,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 91,\n\t\tgrade: \"A\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 51,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 79,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 37,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 84,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 45,\n\t\tgrade: \"F\"\n\t}]\n}, {\n\ttitle: \"Networks\",\n\tinstructor: \"Van Emde Boas\",\n\tstudents: [{\n\t\tname: \"e!\",\n\t\tscore: 35,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Albert Gonzalez\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Brian Kernaghan\",\n\t\tscore: 61,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Danielle Bunten Berry\",\n\t\tscore: 59,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Donald Knuth\",\n\t\tscore: 89,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Grace Hopper\",\n\t\tscore: 40,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Hack Kerr\",\n\t\tscore: 102,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"James Gosling\",\n\t\tscore: 39,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ken Thompson\",\n\t\tscore: 83,\n\t\tgrade: \"B\"\n\t}, {\n\t\tname: \"Kevin Mitnick\",\n\t\tscore: 37,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Linus Torvalds\",\n\t\tscore: 65,\n\t\tgrade: \"D\"\n\t}, {\n\t\tname: \"Niklaus Wirth\",\n\t\tscore: 36,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Rebecca Heineman\",\n\t\tscore: 32,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Tim Berners-Lee\",\n\t\tscore: 70,\n\t\tgrade: \"C\"\n\t}, {\n\t\tname: \"Xiao Tian\",\n\t\tscore: 52,\n\t\tgrade: \"F\"\n\t}, {\n\t\tname: \"Ying Cracker\",\n\t\tscore: 62,\n\t\tgrade: \"D\"\n\t}]\n}];\nexport default courses;\n')" + "writeFromFile('data/courses2.js', '06/courses2.js')", + "open('data/courses2.js')" ] }, { @@ -506,8 +504,8 @@ "07/01" ], "actions": [ - "open('data/suspectData.js')", - "set('const suspectData = [{\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Albert Gonzalez\",\n score:35,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Hack Kerr\",\n score:85,\n grade:\"F\"\n}, {\n title:\"Relational Databases\",\n instructor:\"Sean Quentin Lewis\",\n name:\"Kevin Mitnick\",\n score:72,\n grade:\"C\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Albert Gonzalez\",\n score:37,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Hack Kerr\",\n score:86,\n grade:\"F\"\n}, {\n title:\"3D Computer Graphics\",\n instructor:\"G.L. Webb\",\n name:\"Kevin Mitnick\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Albert Gonzalez\",\n score:73,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Hack Kerr\",\n score:92,\n grade:\"C\"\n}, {\n title:\"Front End Web Development\",\n instructor:\"Moe Zaick\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Albert Gonzalez\",\n score:74,\n grade:\"C\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Hack Kerr\",\n score:75,\n grade:\"F\"\n}, {\n title:\"Web Security\",\n instructor:\"Sue Denim\",\n name:\"Kevin Mitnick\",\n score:89,\n grade:\"B\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Albert Gonzalez\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Hack Kerr\",\n score:83,\n grade:\"F\"\n}, {\n title:\"Javascript Fundamentals\",\n instructor:\"Jay Kweerie\",\n name:\"Kevin Mitnick\",\n score:47,\n grade:\"F\"\n},{\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Albert Gonzalez\",\n score:67,\n grade:\"D\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Hack Kerr\",\n score:96,\n grade:\"A\"\n}, {\n title:\"Data Science\",\n instructor:\"Ford Fulkerson\",\n name:\"Kevin Mitnick\",\n score:75,\n grade:\"C\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Albert Gonzalez\",\n score:39,\n grade:\"F\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Hack Kerr\",\n score:94,\n grade:\"A\"\n}, {\n title:\"Algorithm Design\",\n instructor:\"Gale Shapely\",\n name:\"Kevin Mitnick\",\n score:81,\n grade:\"B\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Albert Gonzalez\",\n score:70,\n grade:\"C\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Hack Kerr\",\n score:87,\n grade:\"F\"\n}, {\n title:\"Data Abstraction\",\n instructor:\"Aster Ricks\",\n name:\"Kevin Mitnick\",\n score:41,\n grade:\"F\"\n}, {\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Albert Gonzalez\",\n score:56,\n grade:\"F\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Hack Kerr\",\n score:89,\n grade:\"B\"\n},{\n title:\"Data Structures\",\n instructor:\"Brodal Q.\",\n name:\"Kevin Mitnick\",\n score:40,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Albert Gonzalez\",\n score:52,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Hack Kerr\",\n score:102,\n grade:\"F\"\n}, {\n title:\"Networks\",\n instructor:\"Van Emde Boas\",\n name:\"Kevin Mitnick\",\n score:37,\n grade:\"F\"\n}];\nexport default suspectData;\n')" + "writeFromFile('data/suspectData.js', '07/suspectData.js')", + "open('data/suspectData.js')" ] }, { diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index 6bcdd79..8f6e709 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -25,976 +25,10 @@ console.log( // first instructor Sean Quentin Lewis ``` -+ Load the student data into "students.js" ++ Look in "data/students.js". This is the data we will be working with. Run save to continue. @test('00/01') -@action(open('data/students.js')) -@action(set( -``` -const students = [{ - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Ada Lovelace", - score: 91, - grade: "A" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Albert Gonzalez", - score: 35, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Brian Kernaghan", - score: 35, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Danielle Bunten Berry", - score: 78, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Donald Knuth", - score: 94, - grade: "A" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Grace Hopper", - score: 36, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Hack Kerr", - score: 85, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "James Gosling", - score: 30, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Ken Thompson", - score: 30, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Kevin Mitnick", - score: 72, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Linus Torvalds", - score: 34, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Niklaus Wirth", - score: 75, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Rebecca Heineman", - score: 71, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Tim Berners-Lee", - score: 54, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Xiao Tian", - score: 67, - grade: "D" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Ying Cracker", - score: 57, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Ada Lovelace", - score: 88, - grade: "B" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Albert Gonzalez", - score: 37, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Brian Kernaghan", - score: 76, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Danielle Bunten Berry", - score: 53, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Donald Knuth", - score: 34, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Grace Hopper", - score: 74, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Hack Kerr", - score: 86, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "James Gosling", - score: 94, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Ken Thompson", - score: 48, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Kevin Mitnick", - score: 52, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Linus Torvalds", - score: 90, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Niklaus Wirth", - score: 78, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Rebecca Heineman", - score: 73, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Tim Berners-Lee", - score: 94, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Xiao Tian", - score: 45, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Ying Cracker", - score: 77, - grade: "C" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Ada Lovelace", - score: 61, - grade: "D" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Albert Gonzalez", - score: 73, - grade: "C" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Brian Kernaghan", - score: 47, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Danielle Bunten Berry", - score: 87, - grade: "B" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Donald Knuth", - score: 80, - grade: "B" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Grace Hopper", - score: 80, - grade: "B" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Hack Kerr", - score: 92, - grade: "C" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "James Gosling", - score: 97, - grade: "A" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Ken Thompson", - score: 64, - grade: "D" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Kevin Mitnick", - score: 47, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Linus Torvalds", - score: 58, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Niklaus Wirth", - score: 93, - grade: "A" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Rebecca Heineman", - score: 58, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Tim Berners-Lee", - score: 98, - grade: "A" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Xiao Tian", - score: 36, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Ying Cracker", - score: 73, - grade: "C" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Ada Lovelace", - score: 81, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Albert Gonzalez", - score: 74, - grade: "C" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Brian Kernaghan", - score: 92, - grade: "A" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Danielle Bunten Berry", - score: 34, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Donald Knuth", - score: 44, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Grace Hopper", - score: 81, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Hack Kerr", - score: 75, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "James Gosling", - score: 95, - grade: "A" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Ken Thompson", - score: 84, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Kevin Mitnick", - score: 89, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Linus Torvalds", - score: 57, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Niklaus Wirth", - score: 88, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Rebecca Heineman", - score: 93, - grade: "A" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Tim Berners-Lee", - score: 36, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Xiao Tian", - score: 87, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Ying Cracker", - score: 42, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Ada Lovelace", - score: 73, - grade: "C" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Albert Gonzalez", - score: 94, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Brian Kernaghan", - score: 71, - grade: "C" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Danielle Bunten Berry", - score: 66, - grade: "D" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Donald Knuth", - score: 94, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Grace Hopper", - score: 99, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Hack Kerr", - score: 83, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "James Gosling", - score: 99, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Ken Thompson", - score: 65, - grade: "D" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Kevin Mitnick", - score: 47, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Linus Torvalds", - score: 93, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Niklaus Wirth", - score: 50, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Rebecca Heineman", - score: 33, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Tim Berners-Lee", - score: 51, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Xiao Tian", - score: 87, - grade: "B" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Ying Cracker", - score: 60, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Ada Lovelace", - score: 58, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Albert Gonzalez", - score: 67, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Brian Kernaghan", - score: 66, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Danielle Bunten Berry", - score: 36, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Donald Knuth", - score: 36, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Grace Hopper", - score: 66, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Hack Kerr", - score: 96, - grade: "A" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "James Gosling", - score: 83, - grade: "B" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Ken Thompson", - score: 35, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Kevin Mitnick", - score: 75, - grade: "C" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Linus Torvalds", - score: 63, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Niklaus Wirth", - score: 75, - grade: "C" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Rebecca Heineman", - score: 84, - grade: "B" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Tim Berners-Lee", - score: 41, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Xiao Tian", - score: 49, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Ying Cracker", - score: 96, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Ada Lovelace", - score: 93, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Albert Gonzalez", - score: 39, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Brian Kernaghan", - score: 69, - grade: "D" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Danielle Bunten Berry", - score: 54, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Donald Knuth", - score: 83, - grade: "B" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Grace Hopper", - score: 31, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Hack Kerr", - score: 94, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "James Gosling", - score: 35, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Ken Thompson", - score: 67, - grade: "D" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Kevin Mitnick", - score: 81, - grade: "B" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Linus Torvalds", - score: 70, - grade: "C" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Niklaus Wirth", - score: 74, - grade: "C" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Rebecca Heineman", - score: 92, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Tim Berners-Lee", - score: 48, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Xiao Tian", - score: 80, - grade: "B" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Ying Cracker", - score: 84, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Ada Lovelace", - score: 82, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Albert Gonzalez", - score: 70, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Brian Kernaghan", - score: 89, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Danielle Bunten Berry", - score: 38, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Donald Knuth", - score: 86, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Grace Hopper", - score: 42, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Hack Kerr", - score: 87, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "James Gosling", - score: 89, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Ken Thompson", - score: 86, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Kevin Mitnick", - score: 41, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Linus Torvalds", - score: 76, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Niklaus Wirth", - score: 78, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Rebecca Heineman", - score: 70, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Tim Berners-Lee", - score: 74, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Xiao Tian", - score: 93, - grade: "A" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Ying Cracker", - score: 95, - grade: "A" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Ada Lovelace", - score: 88, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Albert Gonzalez", - score: 56, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Brian Kernaghan", - score: 58, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Danielle Bunten Berry", - score: 38, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Donald Knuth", - score: 85, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Grace Hopper", - score: 53, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Hack Kerr", - score: 89, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "James Gosling", - score: 42, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Ken Thompson", - score: 87, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Kevin Mitnick", - score: 40, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Linus Torvalds", - score: 91, - grade: "A" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Niklaus Wirth", - score: 51, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Rebecca Heineman", - score: 79, - grade: "C" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Tim Berners-Lee", - score: 37, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Xiao Tian", - score: 84, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Ying Cracker", - score: 45, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Ada Lovelace", - score: 65, - grade: "D" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Albert Gonzalez", - score: 52, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Brian Kernaghan", - score: 61, - grade: "D" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Danielle Bunten Berry", - score: 59, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Donald Knuth", - score: 89, - grade: "B" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Grace Hopper", - score: 40, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Hack Kerr", - score: 102, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "James Gosling", - score: 39, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Ken Thompson", - score: 83, - grade: "B" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Kevin Mitnick", - score: 37, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Linus Torvalds", - score: 65, - grade: "D" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Niklaus Wirth", - score: 36, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Rebecca Heineman", - score: 32, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Tim Berners-Lee", - score: 70, - grade: "C" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Xiao Tian", - score: 52, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Ying Cracker", - score: 62, - grade: "D" -}]; -export default students; -``` -)) - +@action(writeFromFile('data/students.js', '00/data.js')) +@open('data/students.js') + Set `first` to the first item in the `students` array. @test('00/02') diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index e8ca1f3..01faf8c 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -32,57 +32,10 @@ Alright, now time to sort your best grades to the top. First you'll need to write a sort condition function called `compareScore`. -+ load `myBest` ++ look at the data we will work with next: `myBest`. Save to continue. @test('02/01') -@action(open('data/myBest.js')) -@action(set( -``` -const myBest = [{ - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Ada Lovelace", - score: 91, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Ada Lovelace", - score: 88, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Ada Lovelace", - score: 81, - grade: "B" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Ada Lovelace", - score: 73, - grade: "C" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Ada Lovelace", - score: 93, - grade: "A" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Ada Lovelace", - score: 82, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Ada Lovelace", - score: 88, - grade: "B" -}]; -export default myBest; -``` -)) +@action(writeFromFile('data/myBest.js', '02/myBest.js')) +@open('data/myBest.js') + `compareScore` should return 1 if the first score is less than the second @test('02/02') diff --git a/tutorial/03/map.md b/tutorial/03/map.md index 1b49fcf..9c70a7d 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -58,73 +58,8 @@ Let's go back to before we filtered out the bad grades, and instead change the g + load "myCourses" @test('03/01') +@action(writeFromFile('data/myCourses.js', '03/myCourses.js')) @action(open('data/myCourses.js')) -@action(set( -``` -const myCourses = [{ - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Ada Lovelace", - score:91, - grade:"A" -}, { - title:"3D Computer Graphics", - instructor:"G.L. Webb", - name:"Ada Lovelace", - score:88, - grade:"B" -}, { - title:"Front End Web Development", - instructor:"Moe Zaick", - name:"Ada Lovelace", - score:61, - grade:"D" -}, { - title:"Web Security", - instructor:"Sue Denim", - name:"Ada Lovelace", - score:81, - grade:"B" -}, { - title:"Javascript Fundamentals", - instructor:"Jay Kweerie", - name:"Ada Lovelace", - score:73, - grade:"C" -}, { - title:"Data Science", - instructor:"Ford Fulkerson", - name:"Ada Lovelace", - score:58, - grade:"F" -}, { - title:"Algorithm Design", - instructor:"Gale Shapely", - name:"Ada Lovelace", - score:93, - grade:"A" -}, { - title:"Data Abstraction", - instructor:"Aster Ricks", - name:"Ada Lovelace", - score:82, - grade:"B" -}, { - title:"Data Structures", - instructor:"Brodal Q.", - name:"Ada Lovelace", - score:88, - grade:"B" -}, { - title:"Networks", - instructor:"Van Emde Boas", - name:"Ada Lovelace", - score:65, - grade:"D" -}]; -export default myCourses; -``` -)) + Make a function `changeGrade` that takes a course and changes the grade to an "A" @test('03/02') diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index 7c138fe..d0c7e7b 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -86,75 +86,10 @@ function addOneToLog(x) { Now that we see how `forEach` works, let's use it to make calls to the `console`. -+ load "myFixed" ++ checkout the data we'll use next: "myFixed". Save to continue. @test('04/01') +@action(writeFromFile('data/myFixed.js', '04/myFixed.js')) @action(open('data/myFixed.js')) -@action(set( -``` -const myFixed = [{ - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Ada Lovelace", - score:95, - grade:"A" -}, { - title:"3D Computer Graphics", - instructor:"G.L. Webb", - name:"Ada Lovelace", - score:95, - grade:"A" -}, { - title:"Front End Web Development", - instructor:"Moe Zaick", - name:"Ada Lovelace", - score:73, - grade:"C" -}, { - title:"Web Security", - instructor:"Sue Denim", - name:"Ada Lovelace", - score:93, - grade:"A" -}, { - title:"Javascript Fundamentals", - instructor:"Jay Kweerie", - name:"Ada Lovelace", - score:85, - grade:"B" -}, { - title:"Data Science", - instructor:"Ford Fulkerson", - name:"Ada Lovelace", - score:70, - grade:"C" -}, { - title:"Algorithm Design", - instructor:"Gale Shapely", - name:"Ada Lovelace", - score:95, - grade:"A" -}, { - title:"Data Abstraction", - instructor:"Aster Ricks", - name:"Ada Lovelace", - score:94, - grade:"A" -}, { - title:"Data Structures", - instructor:"Brodal Q.", - name:"Ada Lovelace", - score:95, - grade:"A" -}, { - title:"Networks", - instructor:"Van Emde Boas", - name:"Ada Lovelace", - score:77, - grade:"C" -}]; -export default myFixed; -``` -)) + Use `forEach` to log out your report card to the console @test('04/02') diff --git a/tutorial/05/find.md b/tutorial/05/find.md index 048eaf2..d0b8aa8 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -25,975 +25,10 @@ data.find(isEven); Find is great for performantly matching unique values in data, such as an "id", or in our case: a name. -+ load "students" data ++ load "students" data. Save to continue. @test('05/01') +@action(writeFromFile('data/myCourses2.js', '05/courses.js')) @action(open('data/myCourses2.js')) -@action(set( -``` -const myCourses = [{ - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "!f", - score: 91, - grade: "A" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Albert Gonzalez", - score: 35, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Brian Kernaghan", - score: 35, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Danielle Bunten Berry", - score: 78, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Donald Knuth", - score: 94, - grade: "A" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Grace Hopper", - score: 36, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Hack Kerr", - score: 85, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "James Gosling", - score: 30, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Ken Thompson", - score: 30, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Kevin Mitnick", - score: 72, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Linus Torvalds", - score: 34, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Niklaus Wirth", - score: 75, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Rebecca Heineman", - score: 71, - grade: "C" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Tim Berners-Lee", - score: 54, - grade: "F" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Xiao Tian", - score: 67, - grade: "D" -}, { - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - name: "Ying Cracker", - score: 57, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "in", - score: 88, - grade: "B" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Albert Gonzalez", - score: 37, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Brian Kernaghan", - score: 76, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Danielle Bunten Berry", - score: 53, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Donald Knuth", - score: 34, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Grace Hopper", - score: 74, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Hack Kerr", - score: 86, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "James Gosling", - score: 94, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Ken Thompson", - score: 48, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Kevin Mitnick", - score: 52, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Linus Torvalds", - score: 90, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Niklaus Wirth", - score: 78, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Rebecca Heineman", - score: 73, - grade: "C" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Tim Berners-Lee", - score: 94, - grade: "A" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Xiao Tian", - score: 45, - grade: "F" -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - name: "Ying Cracker", - score: 77, - grade: "C" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "dt", - score: 61, - grade: "D" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Albert Gonzalez", - score: 73, - grade: "C" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Brian Kernaghan", - score: 47, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Danielle Bunten Berry", - score: 87, - grade: "B" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Donald Knuth", - score: 80, - grade: "B" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Grace Hopper", - score: 80, - grade: "B" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Hack Kerr", - score: 92, - grade: "C" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "James Gosling", - score: 97, - grade: "A" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Ken Thompson", - score: 64, - grade: "D" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Kevin Mitnick", - score: 47, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Linus Torvalds", - score: 58, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Niklaus Wirth", - score: 93, - grade: "A" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Rebecca Heineman", - score: 58, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Tim Berners-Lee", - score: 98, - grade: "A" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Xiao Tian", - score: 36, - grade: "F" -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - name: "Ying Cracker", - score: 73, - grade: "C" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Donald Knuth", - score: 44, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Albert Gonzalez", - score: 74, - grade: "C" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Brian Kernaghan", - score: 92, - grade: "A" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Danielle Bunten Berry", - score: 34, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "he", - score: 81, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Grace Hopper", - score: 81, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Hack Kerr", - score: 75, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "James Gosling", - score: 95, - grade: "A" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Ken Thompson", - score: 84, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Kevin Mitnick", - score: 89, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Linus Torvalds", - score: 57, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Niklaus Wirth", - score: 88, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Rebecca Heineman", - score: 93, - grade: "A" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Tim Berners-Lee", - score: 36, - grade: "F" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Xiao Tian", - score: 87, - grade: "B" -}, { - title: "Web Security", - instructor: "Sue Denim", - name: "Ying Cracker", - score: 42, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "be", - score: 73, - grade: "C" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Albert Gonzalez", - score: 94, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Brian Kernaghan", - score: 71, - grade: "C" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Danielle Bunten Berry", - score: 66, - grade: "D" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Donald Knuth", - score: 94, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Grace Hopper", - score: 99, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Hack Kerr", - score: 83, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "James Gosling", - score: 99, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Ken Thompson", - score: 65, - grade: "D" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Kevin Mitnick", - score: 47, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Linus Torvalds", - score: 93, - grade: "A" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Niklaus Wirth", - score: 50, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Rebecca Heineman", - score: 33, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Tim Berners-Lee", - score: 51, - grade: "F" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Xiao Tian", - score: 87, - grade: "B" -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - name: "Ying Cracker", - score: 60, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "st", - score: 58, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Albert Gonzalez", - score: 67, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Brian Kernaghan", - score: 66, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Danielle Bunten Berry", - score: 36, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Donald Knuth", - score: 36, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Grace Hopper", - score: 66, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Hack Kerr", - score: 96, - grade: "A" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "James Gosling", - score: 83, - grade: "B" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Ken Thompson", - score: 35, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Kevin Mitnick", - score: 75, - grade: "C" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Linus Torvalds", - score: 63, - grade: "D" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Niklaus Wirth", - score: 75, - grade: "C" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Rebecca Heineman", - score: 84, - grade: "B" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Tim Berners-Lee", - score: 41, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Xiao Tian", - score: 49, - grade: "F" -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - name: "Ying Cracker", - score: 96, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "re", - score: 93, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Albert Gonzalez", - score: 39, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Brian Kernaghan", - score: 69, - grade: "D" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Danielle Bunten Berry", - score: 54, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Donald Knuth", - score: 83, - grade: "B" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Grace Hopper", - score: 31, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Hack Kerr", - score: 94, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "James Gosling", - score: 35, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Ken Thompson", - score: 67, - grade: "D" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Kevin Mitnick", - score: 81, - grade: "B" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Linus Torvalds", - score: 70, - grade: "C" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Niklaus Wirth", - score: 74, - grade: "C" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Rebecca Heineman", - score: 92, - grade: "A" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Tim Berners-Lee", - score: 48, - grade: "F" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Xiao Tian", - score: 80, - grade: "B" -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - name: "Ying Cracker", - score: 84, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "ve", - score: 82, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Albert Gonzalez", - score: 70, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Brian Kernaghan", - score: 89, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Danielle Bunten Berry", - score: 38, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Donald Knuth", - score: 86, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Grace Hopper", - score: 42, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Hack Kerr", - score: 87, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "James Gosling", - score: 89, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Ken Thompson", - score: 86, - grade: "B" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Kevin Mitnick", - score: 41, - grade: "F" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Linus Torvalds", - score: 76, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Niklaus Wirth", - score: 78, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Rebecca Heineman", - score: 70, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Tim Berners-Lee", - score: 74, - grade: "C" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Xiao Tian", - score: 93, - grade: "A" -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - name: "Ying Cracker", - score: 95, - grade: "A" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "ng", - score: 88, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Albert Gonzalez", - score: 56, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Brian Kernaghan", - score: 58, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Danielle Bunten Berry", - score: 38, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Donald Knuth", - score: 85, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Grace Hopper", - score: 53, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Hack Kerr", - score: 89, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "James Gosling", - score: 42, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Ken Thompson", - score: 87, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Kevin Mitnick", - score: 40, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Linus Torvalds", - score: 91, - grade: "A" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Niklaus Wirth", - score: 51, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Rebecca Heineman", - score: 79, - grade: "C" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Tim Berners-Lee", - score: 37, - grade: "F" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Xiao Tian", - score: 84, - grade: "B" -}, { - title: "Data Structures", - instructor: "Brodal Q.", - name: "Ying Cracker", - score: 45, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "e!", - score: 65, - grade: "D" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Albert Gonzalez", - score: 52, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Brian Kernaghan", - score: 61, - grade: "D" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Danielle Bunten Berry", - score: 59, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Donald Knuth", - score: 89, - grade: "B" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Grace Hopper", - score: 40, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Hack Kerr", - score: 102, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "James Gosling", - score: 39, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Ken Thompson", - score: 83, - grade: "B" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Kevin Mitnick", - score: 37, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Linus Torvalds", - score: 65, - grade: "D" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Niklaus Wirth", - score: 36, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Rebecca Heineman", - score: 32, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Tim Berners-Lee", - score: 70, - grade: "C" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Xiao Tian", - score: 52, - grade: "F" -}, { - title: "Networks", - instructor: "Van Emde Boas", - name: "Ying Cracker", - score: 62, - grade: "D" -}]; -export default myCourses; -``` -)) + `filter` to `courses` in the class titled "Web Security" @test('05/02') diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index 211a4bf..a8c8cac 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -97,693 +97,8 @@ We'll test out flatten, then re-create our student array of data from the origin + load "courses" @test('06/01') +@action(writeFromFile('data/courses2.js', '06/courses2.js')) @action(open('data/courses2.js')) -@action(set( -``` -const courses = [{ - title: "Relational Databases", - instructor: "Sean Quentin Lewis", - students: [{ - name: "!f", - score: 61, - grade: "D" - }, { - name: "Albert Gonzalez", - score: 35, - grade: "F" - }, { - name: "Brian Kernaghan", - score: 35, - grade: "F" - }, { - name: "Danielle Bunten Berry", - score: 78, - grade: "C" - }, { - name: "Donald Knuth", - score: 94, - grade: "A" - }, { - name: "Grace Hopper", - score: 36, - grade: "F" - }, { - name: "Hack Kerr", - score: 85, - grade: "F" - }, { - name: "James Gosling", - score: 30, - grade: "F" - }, { - name: "Ken Thompson", - score: 30, - grade: "F" - }, { - name: "Kevin Mitnick", - score: 72, - grade: "C" - }, { - name: "Linus Torvalds", - score: 34, - grade: "F" - }, { - name: "Niklaus Wirth", - score: 75, - grade: "C" - }, { - name: "Rebecca Heineman", - score: 71, - grade: "C" - }, { - name: "Tim Berners-Lee", - score: 54, - grade: "F" - }, { - name: "Xiao Tian", - score: 67, - grade: "D" - }, { - name: "Ying Cracker", - score: 57, - grade: "F" - }] -}, { - title: "3D Computer Graphics", - instructor: "G.L. Webb", - students: [{ - name: "in", - score: 58, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 37, - grade: "F" - }, { - name: "Brian Kernaghan", - score: 76, - grade: "C" - }, { - name: "Danielle Bunten Berry", - score: 53, - grade: "F" - }, { - name: "Donald Knuth", - score: 34, - grade: "F" - }, { - name: "Grace Hopper", - score: 74, - grade: "C" - }, { - name: "Hack Kerr", - score: 86, - grade: "F" - }, { - name: "James Gosling", - score: 94, - grade: "A" - }, { - name: "Ken Thompson", - score: 48, - grade: "F" - }, { - name: "Kevin Mitnick", - score: 52, - grade: "F" - }, { - name: "Linus Torvalds", - score: 90, - grade: "A" - }, { - name: "Niklaus Wirth", - score: 78, - grade: "C" - }, { - name: "Rebecca Heineman", - score: 73, - grade: "C" - }, { - name: "Tim Berners-Lee", - score: 94, - grade: "A" - }, { - name: "Xiao Tian", - score: 45, - grade: "F" - }, { - name: "Ying Cracker", - score: 77, - grade: "C" - }] -}, { - title: "Front End Web Development", - instructor: "Moe Zaick", - students: [{ - name: "dt", - score: 31, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 73, - grade: "C" - }, { - name: "Brian Kernaghan", - score: 47, - grade: "F" - }, { - name: "Danielle Bunten Berry", - score: 87, - grade: "B" - }, { - name: "Donald Knuth", - score: 80, - grade: "B" - }, { - name: "Grace Hopper", - score: 80, - grade: "B" - }, { - name: "Hack Kerr", - score: 92, - grade: "C" - }, { - name: "James Gosling", - score: 97, - grade: "A" - }, { - name: "Ken Thompson", - score: 64, - grade: "D" - }, { - name: "Kevin Mitnick", - score: 47, - grade: "F" - }, { - name: "Linus Torvalds", - score: 58, - grade: "F" - }, { - name: "Niklaus Wirth", - score: 93, - grade: "A" - }, { - name: "Rebecca Heineman", - score: 58, - grade: "F" - }, { - name: "Tim Berners-Lee", - score: 98, - grade: "A" - }, { - name: "Xiao Tian", - score: 36, - grade: "F" - }, { - name: "Ying Cracker", - score: 73, - grade: "C" - }] -}, { - title: "Web Security", - instructor: "Sue Denim", - students: [{ - name: "he", - score: 51, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 74, - grade: "C" - }, { - name: "Brian Kernaghan", - score: 92, - grade: "A" - }, { - name: "Danielle Bunten Berry", - score: 34, - grade: "F" - }, { - name: "Donald Knuth", - score: 44, - grade: "F" - }, { - name: "Grace Hopper", - score: 81, - grade: "B" - }, { - name: "Hack Kerr", - score: 75, - grade: "F" - }, { - name: "James Gosling", - score: 95, - grade: "A" - }, { - name: "Ken Thompson", - score: 84, - grade: "B" - }, { - name: "Kevin Mitnick", - score: 89, - grade: "B" - }, { - name: "Linus Torvalds", - score: 57, - grade: "F" - }, { - name: "Niklaus Wirth", - score: 88, - grade: "B" - }, { - name: "Rebecca Heineman", - score: 93, - grade: "A" - }, { - name: "Tim Berners-Lee", - score: 36, - grade: "F" - }, { - name: "Xiao Tian", - score: 87, - grade: "B" - }, { - name: "Ying Cracker", - score: 42, - grade: "F" - }] -}, { - title: "Javascript Fundamentals", - instructor: "Jay Kweerie", - students: [{ - name: "be", - score: 43, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 94, - grade: "A" - }, { - name: "Brian Kernaghan", - score: 71, - grade: "C" - }, { - name: "Danielle Bunten Berry", - score: 66, - grade: "D" - }, { - name: "Donald Knuth", - score: 94, - grade: "A" - }, { - name: "Grace Hopper", - score: 99, - grade: "A" - }, { - name: "Hack Kerr", - score: 83, - grade: "F" - }, { - name: "James Gosling", - score: 99, - grade: "A" - }, { - name: "Ken Thompson", - score: 65, - grade: "D" - }, { - name: "Kevin Mitnick", - score: 47, - grade: "F" - }, { - name: "Linus Torvalds", - score: 93, - grade: "A" - }, { - name: "Niklaus Wirth", - score: 50, - grade: "F" - }, { - name: "Rebecca Heineman", - score: 33, - grade: "F" - }, { - name: "Tim Berners-Lee", - score: 51, - grade: "F" - }, { - name: "Xiao Tian", - score: 87, - grade: "B" - }, { - name: "Ying Cracker", - score: 60, - grade: "D" - }] -}, { - title: "Data Science", - instructor: "Ford Fulkerson", - students: [{ - name: "st", - score: 28, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 67, - grade: "D" - }, { - name: "Brian Kernaghan", - score: 66, - grade: "D" - }, { - name: "Danielle Bunten Berry", - score: 36, - grade: "F" - }, { - name: "Donald Knuth", - score: 36, - grade: "F" - }, { - name: "Grace Hopper", - score: 66, - grade: "D" - }, { - name: "Hack Kerr", - score: 96, - grade: "A" - }, { - name: "James Gosling", - score: 83, - grade: "B" - }, { - name: "Ken Thompson", - score: 35, - grade: "F" - }, { - name: "Kevin Mitnick", - score: 75, - grade: "C" - }, { - name: "Linus Torvalds", - score: 63, - grade: "D" - }, { - name: "Niklaus Wirth", - score: 75, - grade: "C" - }, { - name: "Rebecca Heineman", - score: 84, - grade: "B" - }, { - name: "Tim Berners-Lee", - score: 41, - grade: "F" - }, { - name: "Xiao Tian", - score: 49, - grade: "F" - }, { - name: "Ying Cracker", - score: 96, - grade: "A" - }] -}, { - title: "Algorithm Design", - instructor: "Gale Shapely", - students: [{ - name: "re", - score: 63, - grade: "D" - }, { - name: "Albert Gonzalez", - score: 39, - grade: "F" - }, { - name: "Brian Kernaghan", - score: 69, - grade: "D" - }, { - name: "Danielle Bunten Berry", - score: 54, - grade: "F" - }, { - name: "Donald Knuth", - score: 83, - grade: "B" - }, { - name: "Grace Hopper", - score: 31, - grade: "F" - }, { - name: "Hack Kerr", - score: 94, - grade: "A" - }, { - name: "James Gosling", - score: 35, - grade: "F" - }, { - name: "Ken Thompson", - score: 67, - grade: "D" - }, { - name: "Kevin Mitnick", - score: 81, - grade: "B" - }, { - name: "Linus Torvalds", - score: 70, - grade: "C" - }, { - name: "Niklaus Wirth", - score: 74, - grade: "C" - }, { - name: "Rebecca Heineman", - score: 92, - grade: "A" - }, { - name: "Tim Berners-Lee", - score: 48, - grade: "F" - }, { - name: "Xiao Tian", - score: 80, - grade: "B" - }, { - name: "Ying Cracker", - score: 84, - grade: "B" - }] -}, { - title: "Data Abstraction", - instructor: "Aster Ricks", - students: [{ - name: "ve", - score: 52, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 70, - grade: "C" - }, { - name: "Brian Kernaghan", - score: 89, - grade: "B" - }, { - name: "Danielle Bunten Berry", - score: 38, - grade: "F" - }, { - name: "Donald Knuth", - score: 86, - grade: "B" - }, { - name: "Grace Hopper", - score: 42, - grade: "F" - }, { - name: "Hack Kerr", - score: 87, - grade: "F" - }, { - name: "James Gosling", - score: 89, - grade: "B" - }, { - name: "Ken Thompson", - score: 86, - grade: "B" - }, { - name: "Kevin Mitnick", - score: 41, - grade: "F" - }, { - name: "Linus Torvalds", - score: 76, - grade: "C" - }, { - name: "Niklaus Wirth", - score: 78, - grade: "C" - }, { - name: "Rebecca Heineman", - score: 70, - grade: "C" - }, { - name: "Tim Berners-Lee", - score: 74, - grade: "C" - }, { - name: "Xiao Tian", - score: 93, - grade: "A" - }, { - name: "Ying Cracker", - score: 95, - grade: "A" - }] -}, { - title: "Data Structures", - instructor: "Brodal Q.", - students: [{ - name: "ng", - score: 58, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 56, - grade: "F" - }, { - name: "Brian Kernaghan", - score: 58, - grade: "F" - }, { - name: "Danielle Bunten Berry", - score: 38, - grade: "F" - }, { - name: "Donald Knuth", - score: 85, - grade: "B" - }, { - name: "Grace Hopper", - score: 53, - grade: "F" - }, { - name: "Hack Kerr", - score: 89, - grade: "B" - }, { - name: "James Gosling", - score: 42, - grade: "F" - }, { - name: "Ken Thompson", - score: 87, - grade: "B" - }, { - name: "Kevin Mitnick", - score: 40, - grade: "F" - }, { - name: "Linus Torvalds", - score: 91, - grade: "A" - }, { - name: "Niklaus Wirth", - score: 51, - grade: "F" - }, { - name: "Rebecca Heineman", - score: 79, - grade: "C" - }, { - name: "Tim Berners-Lee", - score: 37, - grade: "F" - }, { - name: "Xiao Tian", - score: 84, - grade: "B" - }, { - name: "Ying Cracker", - score: 45, - grade: "F" - }] -}, { - title: "Networks", - instructor: "Van Emde Boas", - students: [{ - name: "e!", - score: 35, - grade: "F" - }, { - name: "Albert Gonzalez", - score: 52, - grade: "F" - }, { - name: "Brian Kernaghan", - score: 61, - grade: "D" - }, { - name: "Danielle Bunten Berry", - score: 59, - grade: "F" - }, { - name: "Donald Knuth", - score: 89, - grade: "B" - }, { - name: "Grace Hopper", - score: 40, - grade: "F" - }, { - name: "Hack Kerr", - score: 102, - grade: "F" - }, { - name: "James Gosling", - score: 39, - grade: "F" - }, { - name: "Ken Thompson", - score: 83, - grade: "B" - }, { - name: "Kevin Mitnick", - score: 37, - grade: "F" - }, { - name: "Linus Torvalds", - score: 65, - grade: "D" - }, { - name: "Niklaus Wirth", - score: 36, - grade: "F" - }, { - name: "Rebecca Heineman", - score: 32, - grade: "F" - }, { - name: "Tim Berners-Lee", - score: 70, - grade: "C" - }, { - name: "Xiao Tian", - score: 52, - grade: "F" - }, { - name: "Ying Cracker", - score: 62, - grade: "D" - }] -}]; -export default courses; -``` -)) + First, test out `flatten` on the `flattenedArray` @test('06/02') diff --git a/tutorial/06/courses2.js b/tutorial/06/courses2.js new file mode 100644 index 0000000..072e3e7 --- /dev/null +++ b/tutorial/06/courses2.js @@ -0,0 +1,682 @@ +const courses = [{ + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + students: [{ + name: "!f", + score: 61, + grade: "D" + }, { + name: "Albert Gonzalez", + score: 35, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 35, + grade: "F" + }, { + name: "Danielle Bunten Berry", + score: 78, + grade: "C" + }, { + name: "Donald Knuth", + score: 94, + grade: "A" + }, { + name: "Grace Hopper", + score: 36, + grade: "F" + }, { + name: "Hack Kerr", + score: 85, + grade: "F" + }, { + name: "James Gosling", + score: 30, + grade: "F" + }, { + name: "Ken Thompson", + score: 30, + grade: "F" + }, { + name: "Kevin Mitnick", + score: 72, + grade: "C" + }, { + name: "Linus Torvalds", + score: 34, + grade: "F" + }, { + name: "Niklaus Wirth", + score: 75, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 71, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 54, + grade: "F" + }, { + name: "Xiao Tian", + score: 67, + grade: "D" + }, { + name: "Ying Cracker", + score: 57, + grade: "F" + }] +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + students: [{ + name: "in", + score: 58, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 37, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 76, + grade: "C" + }, { + name: "Danielle Bunten Berry", + score: 53, + grade: "F" + }, { + name: "Donald Knuth", + score: 34, + grade: "F" + }, { + name: "Grace Hopper", + score: 74, + grade: "C" + }, { + name: "Hack Kerr", + score: 86, + grade: "F" + }, { + name: "James Gosling", + score: 94, + grade: "A" + }, { + name: "Ken Thompson", + score: 48, + grade: "F" + }, { + name: "Kevin Mitnick", + score: 52, + grade: "F" + }, { + name: "Linus Torvalds", + score: 90, + grade: "A" + }, { + name: "Niklaus Wirth", + score: 78, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 73, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 94, + grade: "A" + }, { + name: "Xiao Tian", + score: 45, + grade: "F" + }, { + name: "Ying Cracker", + score: 77, + grade: "C" + }] +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + students: [{ + name: "dt", + score: 31, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 73, + grade: "C" + }, { + name: "Brian Kernaghan", + score: 47, + grade: "F" + }, { + name: "Danielle Bunten Berry", + score: 87, + grade: "B" + }, { + name: "Donald Knuth", + score: 80, + grade: "B" + }, { + name: "Grace Hopper", + score: 80, + grade: "B" + }, { + name: "Hack Kerr", + score: 92, + grade: "C" + }, { + name: "James Gosling", + score: 97, + grade: "A" + }, { + name: "Ken Thompson", + score: 64, + grade: "D" + }, { + name: "Kevin Mitnick", + score: 47, + grade: "F" + }, { + name: "Linus Torvalds", + score: 58, + grade: "F" + }, { + name: "Niklaus Wirth", + score: 93, + grade: "A" + }, { + name: "Rebecca Heineman", + score: 58, + grade: "F" + }, { + name: "Tim Berners-Lee", + score: 98, + grade: "A" + }, { + name: "Xiao Tian", + score: 36, + grade: "F" + }, { + name: "Ying Cracker", + score: 73, + grade: "C" + }] +}, { + title: "Web Security", + instructor: "Sue Denim", + students: [{ + name: "he", + score: 51, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 74, + grade: "C" + }, { + name: "Brian Kernaghan", + score: 92, + grade: "A" + }, { + name: "Danielle Bunten Berry", + score: 34, + grade: "F" + }, { + name: "Donald Knuth", + score: 44, + grade: "F" + }, { + name: "Grace Hopper", + score: 81, + grade: "B" + }, { + name: "Hack Kerr", + score: 75, + grade: "F" + }, { + name: "James Gosling", + score: 95, + grade: "A" + }, { + name: "Ken Thompson", + score: 84, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 89, + grade: "B" + }, { + name: "Linus Torvalds", + score: 57, + grade: "F" + }, { + name: "Niklaus Wirth", + score: 88, + grade: "B" + }, { + name: "Rebecca Heineman", + score: 93, + grade: "A" + }, { + name: "Tim Berners-Lee", + score: 36, + grade: "F" + }, { + name: "Xiao Tian", + score: 87, + grade: "B" + }, { + name: "Ying Cracker", + score: 42, + grade: "F" + }] +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + students: [{ + name: "be", + score: 43, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 94, + grade: "A" + }, { + name: "Brian Kernaghan", + score: 71, + grade: "C" + }, { + name: "Danielle Bunten Berry", + score: 66, + grade: "D" + }, { + name: "Donald Knuth", + score: 94, + grade: "A" + }, { + name: "Grace Hopper", + score: 99, + grade: "A" + }, { + name: "Hack Kerr", + score: 83, + grade: "F" + }, { + name: "James Gosling", + score: 99, + grade: "A" + }, { + name: "Ken Thompson", + score: 65, + grade: "D" + }, { + name: "Kevin Mitnick", + score: 47, + grade: "F" + }, { + name: "Linus Torvalds", + score: 93, + grade: "A" + }, { + name: "Niklaus Wirth", + score: 50, + grade: "F" + }, { + name: "Rebecca Heineman", + score: 33, + grade: "F" + }, { + name: "Tim Berners-Lee", + score: 51, + grade: "F" + }, { + name: "Xiao Tian", + score: 87, + grade: "B" + }, { + name: "Ying Cracker", + score: 60, + grade: "D" + }] +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + students: [{ + name: "st", + score: 28, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 67, + grade: "D" + }, { + name: "Brian Kernaghan", + score: 66, + grade: "D" + }, { + name: "Danielle Bunten Berry", + score: 36, + grade: "F" + }, { + name: "Donald Knuth", + score: 36, + grade: "F" + }, { + name: "Grace Hopper", + score: 66, + grade: "D" + }, { + name: "Hack Kerr", + score: 96, + grade: "A" + }, { + name: "James Gosling", + score: 83, + grade: "B" + }, { + name: "Ken Thompson", + score: 35, + grade: "F" + }, { + name: "Kevin Mitnick", + score: 75, + grade: "C" + }, { + name: "Linus Torvalds", + score: 63, + grade: "D" + }, { + name: "Niklaus Wirth", + score: 75, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 84, + grade: "B" + }, { + name: "Tim Berners-Lee", + score: 41, + grade: "F" + }, { + name: "Xiao Tian", + score: 49, + grade: "F" + }, { + name: "Ying Cracker", + score: 96, + grade: "A" + }] +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + students: [{ + name: "re", + score: 63, + grade: "D" + }, { + name: "Albert Gonzalez", + score: 39, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 69, + grade: "D" + }, { + name: "Danielle Bunten Berry", + score: 54, + grade: "F" + }, { + name: "Donald Knuth", + score: 83, + grade: "B" + }, { + name: "Grace Hopper", + score: 31, + grade: "F" + }, { + name: "Hack Kerr", + score: 94, + grade: "A" + }, { + name: "James Gosling", + score: 35, + grade: "F" + }, { + name: "Ken Thompson", + score: 67, + grade: "D" + }, { + name: "Kevin Mitnick", + score: 81, + grade: "B" + }, { + name: "Linus Torvalds", + score: 70, + grade: "C" + }, { + name: "Niklaus Wirth", + score: 74, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 92, + grade: "A" + }, { + name: "Tim Berners-Lee", + score: 48, + grade: "F" + }, { + name: "Xiao Tian", + score: 80, + grade: "B" + }, { + name: "Ying Cracker", + score: 84, + grade: "B" + }] +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + students: [{ + name: "ve", + score: 52, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 70, + grade: "C" + }, { + name: "Brian Kernaghan", + score: 89, + grade: "B" + }, { + name: "Danielle Bunten Berry", + score: 38, + grade: "F" + }, { + name: "Donald Knuth", + score: 86, + grade: "B" + }, { + name: "Grace Hopper", + score: 42, + grade: "F" + }, { + name: "Hack Kerr", + score: 87, + grade: "F" + }, { + name: "James Gosling", + score: 89, + grade: "B" + }, { + name: "Ken Thompson", + score: 86, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 41, + grade: "F" + }, { + name: "Linus Torvalds", + score: 76, + grade: "C" + }, { + name: "Niklaus Wirth", + score: 78, + grade: "C" + }, { + name: "Rebecca Heineman", + score: 70, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 74, + grade: "C" + }, { + name: "Xiao Tian", + score: 93, + grade: "A" + }, { + name: "Ying Cracker", + score: 95, + grade: "A" + }] +}, { + title: "Data Structures", + instructor: "Brodal Q.", + students: [{ + name: "ng", + score: 58, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 56, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 58, + grade: "F" + }, { + name: "Danielle Bunten Berry", + score: 38, + grade: "F" + }, { + name: "Donald Knuth", + score: 85, + grade: "B" + }, { + name: "Grace Hopper", + score: 53, + grade: "F" + }, { + name: "Hack Kerr", + score: 89, + grade: "B" + }, { + name: "James Gosling", + score: 42, + grade: "F" + }, { + name: "Ken Thompson", + score: 87, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 40, + grade: "F" + }, { + name: "Linus Torvalds", + score: 91, + grade: "A" + }, { + name: "Niklaus Wirth", + score: 51, + grade: "F" + }, { + name: "Rebecca Heineman", + score: 79, + grade: "C" + }, { + name: "Tim Berners-Lee", + score: 37, + grade: "F" + }, { + name: "Xiao Tian", + score: 84, + grade: "B" + }, { + name: "Ying Cracker", + score: 45, + grade: "F" + }] +}, { + title: "Networks", + instructor: "Van Emde Boas", + students: [{ + name: "e!", + score: 35, + grade: "F" + }, { + name: "Albert Gonzalez", + score: 52, + grade: "F" + }, { + name: "Brian Kernaghan", + score: 61, + grade: "D" + }, { + name: "Danielle Bunten Berry", + score: 59, + grade: "F" + }, { + name: "Donald Knuth", + score: 89, + grade: "B" + }, { + name: "Grace Hopper", + score: 40, + grade: "F" + }, { + name: "Hack Kerr", + score: 102, + grade: "F" + }, { + name: "James Gosling", + score: 39, + grade: "F" + }, { + name: "Ken Thompson", + score: 83, + grade: "B" + }, { + name: "Kevin Mitnick", + score: 37, + grade: "F" + }, { + name: "Linus Torvalds", + score: 65, + grade: "D" + }, { + name: "Niklaus Wirth", + score: 36, + grade: "F" + }, { + name: "Rebecca Heineman", + score: 32, + grade: "F" + }, { + name: "Tim Berners-Lee", + score: 70, + grade: "C" + }, { + name: "Xiao Tian", + score: 52, + grade: "F" + }, { + name: "Ying Cracker", + score: 62, + grade: "D" + }] +}]; +export default courses; diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index 8d3e518..a3a1df3 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -47,193 +47,8 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp + load suspectData. We will come back to this after some practice; @test('07/01') +@action(writeFromFile('data/suspectData.js', '07/suspectData.js')) @action(open('data/suspectData.js')) -@action(set( -``` -const suspectData = [{ - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Albert Gonzalez", - score:35, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Hack Kerr", - score:85, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Kevin Mitnick", - score:72, - grade:"C" -}, { - title:"3D Computer Graphics", - instructor:"G.L. Webb", - name:"Albert Gonzalez", - score:37, - grade:"F" -}, { - title:"3D Computer Graphics", - instructor:"G.L. Webb", - name:"Hack Kerr", - score:86, - grade:"F" -}, { - title:"3D Computer Graphics", - instructor:"G.L. Webb", - name:"Kevin Mitnick", - score:52, - grade:"F" -}, { - title:"Front End Web Development", - instructor:"Moe Zaick", - name:"Albert Gonzalez", - score:73, - grade:"C" -}, { - title:"Front End Web Development", - instructor:"Moe Zaick", - name:"Hack Kerr", - score:92, - grade:"C" -}, { - title:"Front End Web Development", - instructor:"Moe Zaick", - name:"Kevin Mitnick", - score:47, - grade:"F" -}, { - title:"Web Security", - instructor:"Sue Denim", - name:"Albert Gonzalez", - score:74, - grade:"C" -}, { - title:"Web Security", - instructor:"Sue Denim", - name:"Hack Kerr", - score:75, - grade:"F" -}, { - title:"Web Security", - instructor:"Sue Denim", - name:"Kevin Mitnick", - score:89, - grade:"B" -}, { - title:"Javascript Fundamentals", - instructor:"Jay Kweerie", - name:"Albert Gonzalez", - score:94, - grade:"A" -}, { - title:"Javascript Fundamentals", - instructor:"Jay Kweerie", - name:"Hack Kerr", - score:83, - grade:"F" -}, { - title:"Javascript Fundamentals", - instructor:"Jay Kweerie", - name:"Kevin Mitnick", - score:47, - grade:"F" -},{ - title:"Data Science", - instructor:"Ford Fulkerson", - name:"Albert Gonzalez", - score:67, - grade:"D" -}, { - title:"Data Science", - instructor:"Ford Fulkerson", - name:"Hack Kerr", - score:96, - grade:"A" -}, { - title:"Data Science", - instructor:"Ford Fulkerson", - name:"Kevin Mitnick", - score:75, - grade:"C" -}, { - title:"Algorithm Design", - instructor:"Gale Shapely", - name:"Albert Gonzalez", - score:39, - grade:"F" -}, { - title:"Algorithm Design", - instructor:"Gale Shapely", - name:"Hack Kerr", - score:94, - grade:"A" -}, { - title:"Algorithm Design", - instructor:"Gale Shapely", - name:"Kevin Mitnick", - score:81, - grade:"B" -}, { - title:"Data Abstraction", - instructor:"Aster Ricks", - name:"Albert Gonzalez", - score:70, - grade:"C" -}, { - title:"Data Abstraction", - instructor:"Aster Ricks", - name:"Hack Kerr", - score:87, - grade:"F" -}, { - title:"Data Abstraction", - instructor:"Aster Ricks", - name:"Kevin Mitnick", - score:41, - grade:"F" -}, { - title:"Data Structures", - instructor:"Brodal Q.", - name:"Albert Gonzalez", - score:56, - grade:"F" -},{ - title:"Data Structures", - instructor:"Brodal Q.", - name:"Hack Kerr", - score:89, - grade:"B" -},{ - title:"Data Structures", - instructor:"Brodal Q.", - name:"Kevin Mitnick", - score:40, - grade:"F" -}, { - title:"Networks", - instructor:"Van Emde Boas", - name:"Albert Gonzalez", - score:52, - grade:"F" -}, { - title:"Networks", - instructor:"Van Emde Boas", - name:"Hack Kerr", - score:102, - grade:"F" -}, { - title:"Networks", - instructor:"Van Emde Boas", - name:"Kevin Mitnick", - score:37, - grade:"F" -}]; -export default suspectData; -``` -)) + Use `reduce` to sum the numbers in the `practice` array @test('07/02') From 2e86aa59e2cf6fcd0c52c6acec0aa4627fa4b5e0 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 16 Aug 2016 18:17:27 -0700 Subject: [PATCH 42/46] prepare 1.1 release --- CHANGELOG.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c9a10..bcefac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [0.7.0] - 2016-08-16 +## [1.1.0] - 2016-08-16 - use new "writeFromFile" action in atom-coderoad@0.12 -## [0.6.0] - 2016-08-15 +## [1.0.0] - 2016-08-15 - update for mocha-coderoad v0.10 - removed loaders in favor of new syntax - updated for es6 import/exports diff --git a/package.json b/package.json index ce9f18d..141d199 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "1.0.0", + "version": "1.1.0", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ From 9c110c2f9c48e899e042285d396bb981ef71842b Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 23 Aug 2016 11:01:02 -0700 Subject: [PATCH 43/46] typo fixes --- coderoad.json | 2 +- package.json | 2 +- tutorial/00/data.js | 1027 +++++++++++++++++++++++++++++++++++++++--- tutorial/00/setup.md | 1 - 4 files changed, 962 insertions(+), 70 deletions(-) diff --git a/coderoad.json b/coderoad.json index fcca353..242df37 100644 --- a/coderoad.json +++ b/coderoad.json @@ -9,7 +9,7 @@ "description": "Understanding the Data Set\n\nOver this tutorial series, we'll be changing and working with two different data sets. It'll be a big help to first understand what the data looks like.\n\n```json\nvar students = [\n {\n \"title\": \"Relational Databases\",\n \"instructor\": \"Sean Quentin Lewis\",\n \"name\": \"Ada Lovelace\",\n \"score\": 91,\n \"grade\": \"A\"\n },\n ...\n]\n```\n\nHere we have an array of \"student\" objects. To get the first item in the array, you can use the array index. Array indexes start at 0.\n\n```js\nconsole.log(\n 'first instructor', students[0].instructor\n);\n// first instructor Sean Quentin Lewis\n```", "tasks": [ { - "description": "Look in \"data/students.js\". This is the data we will be working with. Run save to continue.\n@open('data/students.js')", + "description": "Look in \"data/students.js\". This is the data we will be working with. Run save to continue.", "tests": [ "00/01" ], diff --git a/package.json b/package.json index 141d199..b249f58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "1.1.0", + "version": "1.1.1", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/00/data.js b/tutorial/00/data.js index e51976d..b0958c2 100644 --- a/tutorial/00/data.js +++ b/tutorial/00/data.js @@ -1,69 +1,962 @@ const students = [{ - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Ada Lovelace", - score:91, - grade:"A" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Albert Gonzalez", - score:35, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Brian Kernaghan", - score:35, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Danielle Bunten Berry", - score:78, - grade:"C" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Donald Knuth", - score:94, - grade:"A" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Grace Hopper", - score:36, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Hack Kerr", - score:85, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"James Gosling", - score:30, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Ken Thompson", - score:30, - grade:"F" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Kevin Mitnick", - score:72, - grade:"C" -}, { - title:"Relational Databases", - instructor:"Sean Quentin Lewis", - name:"Linus Torvalds", - score:34, - grade:"F" -}, { - title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Rebecca Heineman",score:71,grade:"C"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Tim Berners-Lee",score:54,grade:"F"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Xiao Tian",score:67,grade:"D"},{title:"Relational Databases",instructor:"Sean Quentin Lewis",name:"Ying Cracker",score:57,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ada Lovelace",score:88,grade:"B"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Albert Gonzalez",score:37,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Brian Kernaghan",score:76,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Danielle Bunten Berry",score:53,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Donald Knuth",score:34,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Grace Hopper",score:74,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Hack Kerr",score:86,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"James Gosling",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ken Thompson",score:48,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Kevin Mitnick",score:52,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Linus Torvalds",score:90,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Niklaus Wirth",score:78,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Rebecca Heineman",score:73,grade:"C"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Tim Berners-Lee",score:94,grade:"A"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Xiao Tian",score:45,grade:"F"},{title:"3D Computer Graphics",instructor:"G.L. Webb",name:"Ying Cracker",score:77,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ada Lovelace",score:61,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Albert Gonzalez",score:73,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Brian Kernaghan",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Danielle Bunten Berry",score:87,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Donald Knuth",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Grace Hopper",score:80,grade:"B"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Hack Kerr",score:92,grade:"C"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"James Gosling",score:97,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ken Thompson",score:64,grade:"D"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Linus Torvalds",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Niklaus Wirth",score:93,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Rebecca Heineman",score:58,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Tim Berners-Lee",score:98,grade:"A"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Xiao Tian",score:36,grade:"F"},{title:"Front End Web Development",instructor:"Moe Zaick",name:"Ying Cracker",score:73,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Ada Lovelace",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Albert Gonzalez",score:74,grade:"C"},{title:"Web Security",instructor:"Sue Denim",name:"Brian Kernaghan",score:92,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Danielle Bunten Berry",score:34,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Donald Knuth",score:44,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Grace Hopper",score:81,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Hack Kerr",score:75,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"James Gosling",score:95,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Ken Thompson",score:84,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Kevin Mitnick",score:89,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Linus Torvalds",score:57,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Niklaus Wirth",score:88,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Rebecca Heineman",score:93,grade:"A"},{title:"Web Security",instructor:"Sue Denim",name:"Tim Berners-Lee",score:36,grade:"F"},{title:"Web Security",instructor:"Sue Denim",name:"Xiao Tian",score:87,grade:"B"},{title:"Web Security",instructor:"Sue Denim",name:"Ying Cracker",score:42,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ada Lovelace",score:73,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Albert Gonzalez",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Brian Kernaghan",score:71,grade:"C"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Danielle Bunten Berry",score:66,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Donald Knuth",score:94,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Grace Hopper",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Hack Kerr",score:83,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"James Gosling",score:99,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ken Thompson",score:65,grade:"D"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Kevin Mitnick",score:47,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Linus Torvalds",score:93,grade:"A"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Niklaus Wirth",score:50,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Rebecca Heineman",score:33,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Tim Berners-Lee",score:51,grade:"F"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Xiao Tian",score:87,grade:"B"},{title:"Javascript Fundamentals",instructor:"Jay Kweerie",name:"Ying Cracker",score:60,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ada Lovelace",score:58,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Albert Gonzalez",score:67,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Brian Kernaghan",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Danielle Bunten Berry",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Donald Knuth",score:36,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Grace Hopper",score:66,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Hack Kerr",score:96,grade:"A"},{title:"Data Science",instructor:"Ford Fulkerson",name:"James Gosling",score:83,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ken Thompson",score:35,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Kevin Mitnick",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Linus Torvalds",score:63,grade:"D"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Niklaus Wirth",score:75,grade:"C"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Rebecca Heineman",score:84,grade:"B"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Tim Berners-Lee",score:41,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Xiao Tian",score:49,grade:"F"},{title:"Data Science",instructor:"Ford Fulkerson",name:"Ying Cracker",score:96,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ada Lovelace",score:93,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Albert Gonzalez",score:39,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Brian Kernaghan",score:69,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Danielle Bunten Berry",score:54,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Donald Knuth",score:83,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Grace Hopper",score:31,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Hack Kerr",score:94,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"James Gosling",score:35,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ken Thompson",score:67,grade:"D"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Kevin Mitnick",score:81,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Linus Torvalds",score:70,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Niklaus Wirth",score:74,grade:"C"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Rebecca Heineman",score:92,grade:"A"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Tim Berners-Lee",score:48,grade:"F"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Xiao Tian",score:80,grade:"B"},{title:"Algorithm Design",instructor:"Gale Shapely",name:"Ying Cracker",score:84,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ada Lovelace",score:82,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Albert Gonzalez",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Brian Kernaghan",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Donald Knuth",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Grace Hopper",score:42,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Hack Kerr",score:87,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"James Gosling",score:89,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ken Thompson",score:86,grade:"B"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Kevin Mitnick",score:41,grade:"F"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Linus Torvalds",score:76,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Niklaus Wirth",score:78,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Rebecca Heineman",score:70,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Tim Berners-Lee",score:74,grade:"C"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Xiao Tian",score:93,grade:"A"},{title:"Data Abstraction",instructor:"Aster Ricks",name:"Ying Cracker",score:95,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ada Lovelace",score:88,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Albert Gonzalez",score:56,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Brian Kernaghan",score:58,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Danielle Bunten Berry",score:38,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Donald Knuth",score:85,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Grace Hopper",score:53,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Hack Kerr",score:89,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"James Gosling",score:42,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ken Thompson",score:87,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Kevin Mitnick",score:40,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Linus Torvalds",score:91,grade:"A"},{title:"Data Structures",instructor:"Brodal Q.",name:"Niklaus Wirth",score:51,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Rebecca Heineman",score:79,grade:"C"},{title:"Data Structures",instructor:"Brodal Q.",name:"Tim Berners-Lee",score:37,grade:"F"},{title:"Data Structures",instructor:"Brodal Q.",name:"Xiao Tian",score:84,grade:"B"},{title:"Data Structures",instructor:"Brodal Q.",name:"Ying Cracker",score:45,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ada Lovelace",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Albert Gonzalez",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Brian Kernaghan",score:61,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Danielle Bunten Berry",score:59,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Donald Knuth",score:89,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Grace Hopper",score:40,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Hack Kerr",score:102,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"James Gosling",score:39,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ken Thompson",score:83,grade:"B"},{title:"Networks",instructor:"Van Emde Boas",name:"Kevin Mitnick",score:37,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Linus Torvalds",score:65,grade:"D"},{title:"Networks",instructor:"Van Emde Boas",name:"Niklaus Wirth",score:36,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Rebecca Heineman",score:32,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Tim Berners-Lee",score:70,grade:"C"},{title:"Networks",instructor:"Van Emde Boas",name:"Xiao Tian",score:52,grade:"F"},{title:"Networks",instructor:"Van Emde Boas",name:"Ying Cracker",score:62,grade:"D"}]; + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ada Lovelace", + score: 91, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Albert Gonzalez", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Brian Kernaghan", + score: 35, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Danielle Bunten Berry", + score: 78, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Grace Hopper", + score: 36, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Hack Kerr", + score: 85, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "James Gosling", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ken Thompson", + score: 30, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Kevin Mitnick", + score: 72, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Linus Torvalds", + score: 34, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Rebecca Heineman", + score: 71, + grade: "C" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Tim Berners-Lee", + score: 54, + grade: "F" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Xiao Tian", + score: 67, + grade: "D" +}, { + title: "Relational Databases", + instructor: "Sean Quentin Lewis", + name: "Ying Cracker", + score: 57, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ada Lovelace", + score: 88, + grade: "B" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Albert Gonzalez", + score: 37, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Brian Kernaghan", + score: 76, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Danielle Bunten Berry", + score: 53, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Donald Knuth", + score: 34, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Grace Hopper", + score: 74, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Hack Kerr", + score: 86, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "James Gosling", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ken Thompson", + score: 48, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Kevin Mitnick", + score: 52, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Linus Torvalds", + score: 90, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Rebecca Heineman", + score: 73, + grade: "C" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Tim Berners-Lee", + score: 94, + grade: "A" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Xiao Tian", + score: 45, + grade: "F" +}, { + title: "3D Computer Graphics", + instructor: "G.L. Webb", + name: "Ying Cracker", + score: 77, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ada Lovelace", + score: 61, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Albert Gonzalez", + score: 73, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Brian Kernaghan", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Danielle Bunten Berry", + score: 87, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Donald Knuth", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Grace Hopper", + score: 80, + grade: "B" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Hack Kerr", + score: 92, + grade: "C" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "James Gosling", + score: 97, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ken Thompson", + score: 64, + grade: "D" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Linus Torvalds", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Niklaus Wirth", + score: 93, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Rebecca Heineman", + score: 58, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Tim Berners-Lee", + score: 98, + grade: "A" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Xiao Tian", + score: 36, + grade: "F" +}, { + title: "Front End Web Development", + instructor: "Moe Zaick", + name: "Ying Cracker", + score: 73, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ada Lovelace", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Albert Gonzalez", + score: 74, + grade: "C" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Brian Kernaghan", + score: 92, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Danielle Bunten Berry", + score: 34, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Donald Knuth", + score: 44, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Grace Hopper", + score: 81, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Hack Kerr", + score: 75, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "James Gosling", + score: 95, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ken Thompson", + score: 84, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Kevin Mitnick", + score: 89, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Linus Torvalds", + score: 57, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Niklaus Wirth", + score: 88, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Rebecca Heineman", + score: 93, + grade: "A" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Tim Berners-Lee", + score: 36, + grade: "F" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Web Security", + instructor: "Sue Denim", + name: "Ying Cracker", + score: 42, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ada Lovelace", + score: 73, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Albert Gonzalez", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Brian Kernaghan", + score: 71, + grade: "C" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Danielle Bunten Berry", + score: 66, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Donald Knuth", + score: 94, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Grace Hopper", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Hack Kerr", + score: 83, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "James Gosling", + score: 99, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ken Thompson", + score: 65, + grade: "D" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Kevin Mitnick", + score: 47, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Linus Torvalds", + score: 93, + grade: "A" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Niklaus Wirth", + score: 50, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Rebecca Heineman", + score: 33, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Tim Berners-Lee", + score: 51, + grade: "F" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Xiao Tian", + score: 87, + grade: "B" +}, { + title: "Javascript Fundamentals", + instructor: "Jay Kweerie", + name: "Ying Cracker", + score: 60, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ada Lovelace", + score: 58, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Albert Gonzalez", + score: 67, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Brian Kernaghan", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Danielle Bunten Berry", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Donald Knuth", + score: 36, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Grace Hopper", + score: 66, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Hack Kerr", + score: 96, + grade: "A" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "James Gosling", + score: 83, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ken Thompson", + score: 35, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Kevin Mitnick", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Linus Torvalds", + score: 63, + grade: "D" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Niklaus Wirth", + score: 75, + grade: "C" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Rebecca Heineman", + score: 84, + grade: "B" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Tim Berners-Lee", + score: 41, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Xiao Tian", + score: 49, + grade: "F" +}, { + title: "Data Science", + instructor: "Ford Fulkerson", + name: "Ying Cracker", + score: 96, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ada Lovelace", + score: 93, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Albert Gonzalez", + score: 39, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Brian Kernaghan", + score: 69, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Danielle Bunten Berry", + score: 54, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Donald Knuth", + score: 83, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Grace Hopper", + score: 31, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Hack Kerr", + score: 94, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "James Gosling", + score: 35, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ken Thompson", + score: 67, + grade: "D" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Kevin Mitnick", + score: 81, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Linus Torvalds", + score: 70, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Niklaus Wirth", + score: 74, + grade: "C" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Rebecca Heineman", + score: 92, + grade: "A" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Tim Berners-Lee", + score: 48, + grade: "F" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Xiao Tian", + score: 80, + grade: "B" +}, { + title: "Algorithm Design", + instructor: "Gale Shapely", + name: "Ying Cracker", + score: 84, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ada Lovelace", + score: 82, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Albert Gonzalez", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Brian Kernaghan", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Donald Knuth", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Grace Hopper", + score: 42, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Hack Kerr", + score: 87, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "James Gosling", + score: 89, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ken Thompson", + score: 86, + grade: "B" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Kevin Mitnick", + score: 41, + grade: "F" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Linus Torvalds", + score: 76, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Niklaus Wirth", + score: 78, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Rebecca Heineman", + score: 70, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Tim Berners-Lee", + score: 74, + grade: "C" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Xiao Tian", + score: 93, + grade: "A" +}, { + title: "Data Abstraction", + instructor: "Aster Ricks", + name: "Ying Cracker", + score: 95, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ada Lovelace", + score: 88, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Albert Gonzalez", + score: 56, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Brian Kernaghan", + score: 58, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Danielle Bunten Berry", + score: 38, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Donald Knuth", + score: 85, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Grace Hopper", + score: 53, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Hack Kerr", + score: 89, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "James Gosling", + score: 42, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ken Thompson", + score: 87, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Kevin Mitnick", + score: 40, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Linus Torvalds", + score: 91, + grade: "A" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Niklaus Wirth", + score: 51, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Rebecca Heineman", + score: 79, + grade: "C" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Tim Berners-Lee", + score: 37, + grade: "F" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Xiao Tian", + score: 84, + grade: "B" +}, { + title: "Data Structures", + instructor: "Brodal Q.", + name: "Ying Cracker", + score: 45, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ada Lovelace", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Albert Gonzalez", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Brian Kernaghan", + score: 61, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Danielle Bunten Berry", + score: 59, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Donald Knuth", + score: 89, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Grace Hopper", + score: 40, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Hack Kerr", + score: 102, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "James Gosling", + score: 39, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ken Thompson", + score: 83, + grade: "B" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Kevin Mitnick", + score: 37, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Linus Torvalds", + score: 65, + grade: "D" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Niklaus Wirth", + score: 36, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Rebecca Heineman", + score: 32, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Tim Berners-Lee", + score: 70, + grade: "C" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Xiao Tian", + score: 52, + grade: "F" +}, { + title: "Networks", + instructor: "Van Emde Boas", + name: "Ying Cracker", + score: 62, + grade: "D" +}]; export default students; diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index 8f6e709..e765d88 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -28,7 +28,6 @@ console.log( + Look in "data/students.js". This is the data we will be working with. Run save to continue. @test('00/01') @action(writeFromFile('data/students.js', '00/data.js')) -@open('data/students.js') + Set `first` to the first item in the `students` array. @test('00/02') From 5dd11349b5e049f6ebfac78c147c520ae107088d Mon Sep 17 00:00:00 2001 From: ShMcK Date: Tue, 23 Aug 2016 13:13:04 -0700 Subject: [PATCH 44/46] fix bug with \0 octals on Windows --- coderoad.json | 2 +- package.json | 2 +- tutorial/00/02.js | 2 +- tutorial/00/setup.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coderoad.json b/coderoad.json index 242df37..a222e6a 100644 --- a/coderoad.json +++ b/coderoad.json @@ -23,7 +23,7 @@ "00/02" ], "actions": [ - "open('00-setup.js')", + "open('setup.js')", "set('// Welcome to CodeRoad!\nconst students = require('./data/students').default;\n\nvar first = ::>\n')" ], "hints": [ diff --git a/package.json b/package.json index b249f58..8e7a3e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "1.1.1", + "version": "1.1.2", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [ diff --git a/tutorial/00/02.js b/tutorial/00/02.js index 0594a56..89a3510 100644 --- a/tutorial/00/02.js +++ b/tutorial/00/02.js @@ -1,4 +1,4 @@ -const setup = require('BASE/00-setup.js'); +const setup = require('BASE/setup.js'); describe('02 const first', () => { diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md index e765d88..ca9334e 100644 --- a/tutorial/00/setup.md +++ b/tutorial/00/setup.md @@ -31,7 +31,7 @@ console.log( + Set `first` to the first item in the `students` array. @test('00/02') -@action(open('00-setup.js')) +@action(open('setup.js')) @action(set( ``` // Welcome to CodeRoad! From e691c405ca2daad0e526a7e13480ee5739148310 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Thu, 25 Aug 2016 22:53:26 -0700 Subject: [PATCH 45/46] fix es6 imports --- README.md | 48 --------------------------- coderoad.json | 73 ++++++------------------------------------ tutorial/01/01.js | 1 + tutorial/01/filter.md | 2 +- tutorial/02/01.js | 4 +-- tutorial/02/sort.md | 2 +- tutorial/03/01.js | 4 +-- tutorial/03/map.md | 2 +- tutorial/04/01.js | 4 +-- tutorial/04/forEach.md | 2 +- tutorial/05/01.js | 4 +-- tutorial/05/find.md | 2 +- tutorial/06/01.js | 4 +-- tutorial/06/concat.md | 2 +- tutorial/07/01.js | 6 ++-- tutorial/07/02.js | 2 -- tutorial/07/reduce.md | 2 +- 17 files changed, 32 insertions(+), 132 deletions(-) diff --git a/README.md b/README.md index f973a42..e904d25 100644 --- a/README.md +++ b/README.md @@ -415,51 +415,3 @@ Back to business. We have a suspect in mind: a classmate named "Hack Kerr". He's a nice guy, and he's always been friendly to you - but there's something suspicious about him: his name. We'll test out flatten, then re-create our student array of data from the original course data. - -##### reduce - -Array -> anything - -We know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades. - -You can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations. - -`map` has a major limitation: it will always output the same number of elements as the input array. - -When you want to transform data into something different, you'll likely want to use `reduce`. - -Reduce requires two parameters: - - * the running total (set by an initialValue) - * the next value in the array - -```js -function add(total, next) { - console.log(`add(${total}, ${next}) -> ${total + next}`) - return total + next -} - -const initialValue = 100; -[1, 5, 10].reduce(add, initialValue); // initial value - -// add(100, 1) -> 101 -// add(101, 5) -> 106 -// add(106, 10) -> 116 -//> 116 -``` - -Notice in the example we input an array of 3 items and output a single number. The data has been transformed. - -It takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere. - -You may have noticed we've already used `reduce` to `flatten` our arrays. - -```js -Array.prototype.flatten = function() { - return this.reduce((a, b) => a.concat(b), []); -}; -``` - -With `flatten`, the initialValue was set to an empty array which each value was `concat` onto. - -Do some practice with `reduce`, before you use it to narrow down a cheating suspect. diff --git a/coderoad.json b/coderoad.json index a222e6a..bd1b249 100644 --- a/coderoad.json +++ b/coderoad.json @@ -72,7 +72,7 @@ ], "actions": [ "open('01-filter.js')", - "set('const students = require('./data/students').default;\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" + "set('import students from './data/students';\n// Array.filter(fn)\n\nfunction isAda(student) {\n // return true if student name\n // matches \"Ada Lovelace\"\n ::>\n}\n')" ], "hints": [ "Some tasks have hints", @@ -139,7 +139,7 @@ ], "actions": [ "open('02-sort.js')", - "set('const myBest = require('./data/myBest').default;\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" + "set('import myBest from './data/myBest';\n// Array.sort(fn)\n\nfunction compareScore(a, b) {\n switch (true) {\n case b.score > a.score:\n // it should return 1 if b's score is more than a's\n return ::>\n case 'set condition here':\n // it should return -1 if b's score is less than a's\n\n default:\n // it should return 0 if b and a have the same score\n\n }\n}\n')" ] }, { @@ -196,7 +196,7 @@ ], "actions": [ "open('03-map.js')", - "set('const myCourses = require('./data/myCourses').default;\n// Array.map(fn)\n\n/*\n * change any the `course.grade` into an 'A'\n *\n * for example:\n * changeGrade({ grade: 'F' }) === { grade: 'A' };\n*/\n\nfunction changeGrade(course) {\n ::>\n}\n\n')" + "set('import myCourses from './data/myCourses';\n// Array.map(fn)\n\n/*\n * change any the `course.grade` into an 'A'\n *\n * for example:\n * changeGrade({ grade: 'F' }) === { grade: 'A' };\n*/\n\nfunction changeGrade(course) {\n ::>\n}\n\n')" ], "hints": [ "give `changeGrade` a parameter, call it \"course\"", @@ -292,7 +292,7 @@ ], "actions": [ "open('04-forEach.js')", - "set('const myFixed = require('./data/myFixed').default;\n// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" + "set('import myFixed from './data/myFixed';\n// Array.forEach(fn)\n\nfunction logCourse(course) {\n console.log(`${course.grade} ${course.score} ${course.title}`);\n}\n\n// log your grades to the console\nmyFixed.forEach(::>);\n')" ], "hints": [ "call `forEach` with `logCourse`" @@ -357,7 +357,7 @@ ], "actions": [ "open('05-find.js')", - "set('const courses = require('./data/myCourses2');\n// Array.find(fn)\n\n// filter for the course title matching \"Web Security\"\nconst myClass = courses.filter(::>);\n')" + "set('import courses from './data/myCourses2';\n// Array.find(fn)\n\n// filter for the course title matching \"Web Security\"\nconst myClass = courses.filter(::>);\n')" ], "hints": [ "create a `filter` function that takes a param `course`", @@ -435,69 +435,15 @@ ] }, { - "description": "First, test out `flatten` on the `flattenedArray`", + "description": "First, test out `flatten` on the `flattenedArray`\nArray -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nconst initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", "tests": [ "06/02" ], "actions": [ "open('06-concat.js')", - "set('const courses = require('./data/courses2').default;\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n')", - "insert('\nconst numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nconst flattenedArray = numberedList::>;\n')" - ], - "hints": [ - "call `.flatten()` on `numberedList`" - ] - }, - { - "description": "Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score", - "tests": [ - "06/03" - ], - "actions": [ - "insert('\n// map over courses then\n// map over students inside of courses\nconst doubleArray = courses.map((course) => {\n return course.students.map((student) => {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n')" - ], - "hints": [ - "pair `course.title`", - "pair `student.name`" + "set('```\nimport courses from './data/courses2');\n// Array.concat(any)\n\n// Array.prototype can be used to create new Array methods\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n```\n))\n@action(insert(\n```\n\nconst numberedList = [[1, 2], [3, 4]];\n\n// use `flatten` on `numberedList`\nconst flattenedArray = numberedList::>;\n``` \n))\n@hint('call `.flatten()` on `numberedList`')\n\n\n+ Now `map` over the courses array, and `map` over the students array inside of it.\nReturn the fields:\n\n * title\n * instructor\n * name\n * grade\n * score\n@test('06/03')\n@action(insert(\n```\n\n// map over courses then\n// map over students inside of courses\nconst doubleArray = courses.map((course) => {\n return course.students.map((student) => {\n return {\n // fill in the fields\n title: ::>'',\n instructor: '',\n name: '',\n score: '',\n grade: ''\n };\n });\n});\n\n```\n))\n@hint('pair `course.title`')\n@hint('pair `student.name`')\n\n+ Use `flatten` to put all data into a single array. Set `students` to the result.\n@test('06/04')\n@action(insert(\n```\n// `flatten` doubleArray\nconst students = doubleArray::>;\n```\n))\n@hint('call `.flatten()` on `doubleArray`')\n\n+ Use the `suspects` array to `filter` to only data matching the names in the `suspects` array\n@test('06/05')\n@action(insert(\n```\n\nconst suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nconst suspectData = students::>;\n```\n))\n\n+ You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nconst newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.\n@test('06/06')\n@hint('call `suspects.concat()` with `newSuspects`')\n\n\n## redu')" ] }, - { - "description": "Use `flatten` to put all data into a single array. Set `students` to the result.", - "tests": [ - "06/04" - ], - "actions": [ - "insert('// `flatten` doubleArray\nconst students = doubleArray::>;\n')" - ], - "hints": [ - "call `.flatten()` on `doubleArray`" - ] - }, - { - "description": "Use the `suspects` array to `filter` to only data matching the names in the `suspects` array", - "tests": [ - "06/05" - ], - "actions": [ - "insert('\nconst suspects = [\"Hack Kerr\"];\n// filter to data matching `suspects`\n\nconst suspectData = students::>;\n')" - ] - }, - { - "description": "You just thought of two more suspects! Make a new variable called `newSuspects` and add it above `suspects`.\n\n```js\nconst newSuspects = ['Albert Gonzalez', 'Kevin Mitnick'];\n```\n\n`concat` the `newSuspects` onto the `suspects` list.", - "tests": [ - "06/06" - ], - "hints": [ - "call `suspects.concat()` with `newSuspects`" - ] - } - ], - "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" - }, - { - "title": "reduce", - "description": "Array -> anything\n\nWe know our likely suspect is also in the school computer system. Perhaps our suspect also changed his grades.\n\nYou can't be sure who is a cheater, but you can assume if the grades are well above the average, the person is likely to be the culprit. For this, we'll have to do some basic statistical calculations. We'll need a new tool for transforming arrays into different data representations.\n\n`map` has a major limitation: it will always output the same number of elements as the input array.\n\nWhen you want to transform data into something different, you'll likely want to use `reduce`.\n\nReduce requires two parameters:\n\n * the running total (set by an initialValue)\n * the next value in the array\n\n```js\nfunction add(total, next) {\n console.log(`add(${total}, ${next}) -> ${total + next}`)\n return total + next\n}\n\nconst initialValue = 100;\n[1, 5, 10].reduce(add, initialValue); // initial value\n\n// add(100, 1) -> 101\n// add(101, 5) -> 106\n// add(106, 10) -> 116\n//> 116\n```\n\nNotice in the example we input an array of 3 items and output a single number. The data has been transformed.\n\nIt takes a while to wrap your head around `reduce`, but once you do, you'll see it's usefulness everywhere.\n\nYou may have noticed we've already used `reduce` to `flatten` our arrays.\n\n```js\nArray.prototype.flatten = function() {\n return this.reduce((a, b) => a.concat(b), []);\n};\n```\n\nWith `flatten`, the initialValue was set to an empty array which each value was `concat` onto.\n\nDo some practice with `reduce`, before you use it to narrow down a cheating suspect.", - "tasks": [ { "description": "load suspectData. We will come back to this after some practice;", "tests": [ @@ -515,7 +461,7 @@ ], "actions": [ "open('07-reduce.js')", - "set('const courses = require('./data/courses2');\n// Array.reduce(fn(a, b), initialValue)\n\nconst practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nconst total = practice.reduce(::>);\n')" + "set('import courses from './data/courses2';\n// Array.reduce(fn(a, b), initialValue)\n\nconst practice = [1, 1, 2, 3, 5, 8, 13, 21];\n\nfunction add(a, b) {\n return a + b;\n}\n\n// total the numbers using a reduce function\nconst total = practice.reduce(::>);\n')" ], "hints": [ "with only numbers, the initialValue defaults to 0", @@ -587,7 +533,8 @@ "insert('console.log(likelySuspects);\n')" ] } - ] + ], + "onPageComplete": "In the next step, we'll look at using one of the most powerful methods: `reduce`" } ] } \ No newline at end of file diff --git a/tutorial/01/01.js b/tutorial/01/01.js index 5c301cd..359b3fc 100644 --- a/tutorial/01/01.js +++ b/tutorial/01/01.js @@ -1,5 +1,6 @@ var expect = require('chai').expect; +const students = require('BASE/data/students.js'); const filter = require('BASE/01-filter.js'); describe('01 function isAda', () => { diff --git a/tutorial/01/filter.md b/tutorial/01/filter.md index 5915d8a..a794154 100644 --- a/tutorial/01/filter.md +++ b/tutorial/01/filter.md @@ -56,7 +56,7 @@ console.log(students[0]); @action(open('01-filter.js')) @action(set( ``` -const students = require('./data/students').default; +import students from './data/students'; // Array.filter(fn) function isAda(student) { diff --git a/tutorial/02/01.js b/tutorial/02/01.js index 449fc4a..de49578 100644 --- a/tutorial/02/01.js +++ b/tutorial/02/01.js @@ -1,8 +1,8 @@ const expect = require('chai').expect; -describe('01 myBest data', () => { +const myBest = require('BASE/data/myBest.js'); - const myBest = require('BASE/data/myBest.js'); +describe('01 myBest data', () => { it('should be loaded in "data/myBest.js"', () => { expect(myBest).to.not.be.undefined; diff --git a/tutorial/02/sort.md b/tutorial/02/sort.md index 01faf8c..bc358bd 100644 --- a/tutorial/02/sort.md +++ b/tutorial/02/sort.md @@ -42,7 +42,7 @@ First you'll need to write a sort condition function called `compareScore`. @action(open('02-sort.js')) @action(set( ``` -const myBest = require('./data/myBest').default; +import myBest from './data/myBest'; // Array.sort(fn) function compareScore(a, b) { diff --git a/tutorial/03/01.js b/tutorial/03/01.js index a2c68eb..dd3826f 100644 --- a/tutorial/03/01.js +++ b/tutorial/03/01.js @@ -1,8 +1,8 @@ const expect = require('chai').expect; -describe('01 myCourses data', () => { +const myCourses = require('BASE/data/myCourses.js'); - const myCourses = require('BASE/data/myCourses.js'); +describe('01 myCourses data', () => { it('should be loaded in "data/myCourses.js"', () => { expect(myCourses).to.not.be.undefined; diff --git a/tutorial/03/map.md b/tutorial/03/map.md index 9c70a7d..aba2e91 100644 --- a/tutorial/03/map.md +++ b/tutorial/03/map.md @@ -66,7 +66,7 @@ Let's go back to before we filtered out the bad grades, and instead change the g @action(open('03-map.js')) @action(set( ``` -const myCourses = require('./data/myCourses').default; +import myCourses from './data/myCourses'; // Array.map(fn) /* diff --git a/tutorial/04/01.js b/tutorial/04/01.js index 29ddeae..ac49833 100644 --- a/tutorial/04/01.js +++ b/tutorial/04/01.js @@ -3,15 +3,15 @@ const spies = require('chai-spies'); const expect = chai.expect; chai.use(spies); +let myFixed = require('BASE/data/myFixed.js'); if (process.env.TASK_POSITION === '4') { myFixed = []; } + let spy = chai.spy.on(console, 'log'); describe('01 myFixed data', () => { - const myFixed = require('BASE/data/myFixed.js'); - it('should be loaded in "data/myFixed.js"', () => { expect(myFixed).to.not.be.undefined; }); diff --git a/tutorial/04/forEach.md b/tutorial/04/forEach.md index d0c7e7b..dcc2550 100644 --- a/tutorial/04/forEach.md +++ b/tutorial/04/forEach.md @@ -96,7 +96,7 @@ Now that we see how `forEach` works, let's use it to make calls to the `console` @action(open('04-forEach.js')) @action(set( ``` -const myFixed = require('./data/myFixed').default; +import myFixed from './data/myFixed'; // Array.forEach(fn) function logCourse(course) { diff --git a/tutorial/05/01.js b/tutorial/05/01.js index a000205..c312582 100644 --- a/tutorial/05/01.js +++ b/tutorial/05/01.js @@ -1,8 +1,8 @@ const expect = require('chai').expect; -describe('01 courses2 data', () => { +const courses = require('BASE/data/courses2.js'); - const courses = require('BASE/data/courses2.js'); +describe('01 courses2 data', () => { it('should be loaded in "data/courses2.js"', () => { expect(courses).to.not.be.undefined; diff --git a/tutorial/05/find.md b/tutorial/05/find.md index d0b8aa8..71f8496 100644 --- a/tutorial/05/find.md +++ b/tutorial/05/find.md @@ -35,7 +35,7 @@ Find is great for performantly matching unique values in data, such as an "id", @action(open('05-find.js')) @action(set( ``` -const courses = require('./data/myCourses2'); +import courses from './data/myCourses2'; // Array.find(fn) // filter for the course title matching "Web Security" diff --git a/tutorial/06/01.js b/tutorial/06/01.js index 126d809..2dfdedb 100644 --- a/tutorial/06/01.js +++ b/tutorial/06/01.js @@ -1,8 +1,8 @@ const expect = require('chai').expect; -describe('01 load courses', () => { +const courses = require('BASE/data/courses2.js'); - const courses = require('BASE/data/courses2.js'); +describe('01 load courses', () => { it('should be loaded in "data/courses2.js"', () => { expect(courses).to.not.be.undefined; diff --git a/tutorial/06/concat.md b/tutorial/06/concat.md index a8c8cac..d95f2bc 100644 --- a/tutorial/06/concat.md +++ b/tutorial/06/concat.md @@ -105,7 +105,7 @@ We'll test out flatten, then re-create our student array of data from the origin @action(open('06-concat.js')) @action(set( ``` -const courses = require('./data/courses2').default; +import courses from './data/courses2'); // Array.concat(any) // Array.prototype can be used to create new Array methods diff --git a/tutorial/07/01.js b/tutorial/07/01.js index b9ed7a8..0c2740c 100644 --- a/tutorial/07/01.js +++ b/tutorial/07/01.js @@ -1,6 +1,8 @@ -describe('01 suspectData', () => { +const expect = require('chai').expect; + +const suspectData = require('BASE/data/suspectData.js'); - const suspectData = require('BASE/data/suspectData.js'); +describe('01 suspectData', () => { it('should be loaded in "data/suspectData.js"', () => { expect(suspectData).to.not.be.undefined; diff --git a/tutorial/07/02.js b/tutorial/07/02.js index 2799bc3..095db46 100644 --- a/tutorial/07/02.js +++ b/tutorial/07/02.js @@ -1,5 +1,3 @@ -const expect = require('chai').expect; - const reduce = require('BASE/07-reduce.js'); describe('02 const total', () => { diff --git a/tutorial/07/reduce.md b/tutorial/07/reduce.md index a3a1df3..acee202 100644 --- a/tutorial/07/reduce.md +++ b/tutorial/07/reduce.md @@ -55,7 +55,7 @@ Do some practice with `reduce`, before you use it to narrow down a cheating susp @action(open('07-reduce.js')) @action(set( ``` -const courses = require('./data/courses2'); +import courses from './data/courses2'; // Array.reduce(fn(a, b), initialValue) const practice = [1, 1, 2, 3, 5, 8, 13, 21]; From 14c89b9336dfe65d315fd5d9ad089bc8d2b40048 Mon Sep 17 00:00:00 2001 From: ShMcK Date: Thu, 25 Aug 2016 22:55:12 -0700 Subject: [PATCH 46/46] increment version for release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e7a3e2..6940121 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coderoad-functional-school", - "version": "1.1.2", + "version": "1.1.3", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", "contributers": [