diff --git a/.gitignore b/.gitignore index 39baa73..e11dc98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules dev -tutorial/.tmp.js +tutorial/.tmp.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 499e958..bcefac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [1.1.0] - 2016-08-16 +- use new "writeFromFile" action in atom-coderoad@0.12 + +## [1.0.0] - 2016-08-15 +- update for mocha-coderoad v0.10 +- removed loaders in favor of new syntax +- updated for es6 import/exports + +## [0.5.0] - 2016-05-02 +- remove "chapters" + +## [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 + ## [0.1.7] - 2016-02-26 -### Added - Hints for steps 1-7 + +##[0.1.9] - 2016-03-04 +- `@onPageComplete` messages + +##[0.1.10] - 2016-03-07 +- Cursor position added (`::>`) diff --git a/README.md b/README.md index 5fca5d3..e904d25 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,11 +25,33 @@ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. L ## Outline -### Array Methods +##### Start -Using common built-in Javascript array methods such as `map` & `reduce`. +Understanding the Data Set -By the end, you should have an understanding of how to use array methods to manipulate semi-complex data. +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 @@ -39,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'; } @@ -48,8 +72,8 @@ 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']; +```js +const list = ['a', 'b']; list.filter(isA); // if isA(list[0]), add to output array @@ -60,12 +84,12 @@ 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' } -var list = [{item: 'a'}, {item: 'b'}]; +const list = [{item: 'a'}, {item: 'b'}]; list.filter(isB); //> [{item: 'b'}] ``` @@ -74,8 +98,8 @@ 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]); +```js +console.log(students[0]); //> { course: 'Web Security', // instructor: 'Sue Denim', // name: 'Rebecca Heineman', @@ -197,7 +221,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); @@ -226,7 +250,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; @@ -276,8 +300,8 @@ 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]; +```js +const data = [1, 2, 3, 4, 5, 6]; function isEven(num) { return num % 2 === 0; @@ -360,7 +384,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 } @@ -372,7 +396,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, @@ -382,7 +406,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}] ``` @@ -391,65 +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 -} - -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 a6b3c07..bd1b249 100644 --- a/coderoad.json +++ b/coderoad.json @@ -1,489 +1,540 @@ { - "project": { + "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": "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```", - "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')", - "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')" - ], - "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\".", - "tests": [ - "1/01/02-filter" - ], - "actions": [ - "insert('// call filter condition here\nvar myData = data.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 unit 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('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')" - ] - }, - { - "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 unit 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 `changeGrades` that takes student data and changes all grades to \"A\"s.", - "tests": [ - "1/03/01-map" - ], - "actions": [ - "open('03-map.js')", - "set('// 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 `changeGrades` 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')" - ] - }, - { - "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 }`" - ] - } - ] - }, - { - "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('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`" - ] - }, - { - "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.\n\nSomething strange is going on. In the next step we'll try to `find` your data.", - "tests": [ - "1/04/04-forEach" - ], - "actions": [ - "insert('\nconsole.log(myFixed);\n')" - ] - } - ] - }, - { - "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('// 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`" - ] - }, - { - "description": "Very strange. In the next step, let's find out who wants revenge, and give it to him!", - "tests": [ - "1/05/06-find" - ] - } - ] - }, - { - "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.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`" - ] - } - ] - }, - { - "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('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", - "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')" - ] - } - ] - }, - { - "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." + "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": "Look in \"data/students.js\". This is the data we will be working with. Run save to continue.", + "tests": [ + "00/01" + ], + "actions": [ + "writeFromFile('data/students.js', '00/data.js')" + ] + }, + { + "description": "Set `first` to the first item in the `students` array.", + "tests": [ + "00/02" + ], + "actions": [ + "open('setup.js')", + "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", + "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```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\".", + "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": "look at the data we will work with next: `myBest`. Save to continue.\n@open('data/myBest.js')", + "tests": [ + "02/01" + ], + "actions": [ + "writeFromFile('data/myBest.js', '02/myBest.js')" + ] + }, + { + "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.", + "tasks": [ + { + "description": "load \"myCourses\"", + "tests": [ + "03/01" + ], + "actions": [ + "writeFromFile('data/myCourses.js', '03/myCourses.js')", + "open('data/myCourses.js')" + ] + }, + { + "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 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\"", + "set `course.grade` to \"A\"", + "return the changed course" + ] + }, + { + "description": "Map over the `myCourses` with the `changeGrade` function. Set `myChanged` to the result.", + "tests": [ + "03/03" + ], + "actions": [ + "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 `myCourses` and instead increment each score by 12 points.", + "tests": [ + "03/04" + ], + "actions": [ + "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 \"course\"", + "it should increase `course.score`", + "return `course`" + ] + }, + { + "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": [ + "03/05" + ], + "hints": [ + "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. Update your `increaseScore` function to also update the grade by using the `getGrade` function", + "tests": [ + "03/06" + ], + "actions": [ + "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": [ + "call `getGrade` inside of `increaseScore`", + "the `increaseScore` function should set course.grade equal to `getGrade(course.score)`" + ] + }, + { + "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'}\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\"", + "you can destructure the param to be `function({score, grade})`", + "then simply return { score, 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\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": "checkout the data we'll use next: \"myFixed\". Save to continue.", + "tests": [ + "04/01" + ], + "actions": [ + "writeFromFile('data/myFixed.js', '04/myFixed.js')", + "open('data/myFixed.js')" + ] + }, + { + "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```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. Save to continue.", + "tests": [ + "05/01" + ], + "actions": [ + "writeFromFile('data/myCourses2.js', '05/courses.js')", + "open('data/myCourses2.js')" + ] + }, + { + "description": "`filter` to `courses` in the class titled \"Web Security\"", + "tests": [ + "05/02" + ], + "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')" + ], + "hints": [ + "create a `filter` function that takes a param `course`", + "return `true` if a condition matches, otherwise `false`", + "filter for `course.title === \"Web Security\"`" + ] + }, + { + "description": "`find` the name in `myClass` that isn't in the list of known students", + "tests": [ + "05/03" + ], + "actions": [ + "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", + "use `otherStudents.indexOf(x) === -1` to find what doesn't match", + "match for `student.name`" + ] + }, + { + "description": "`filter` down to students from courses without known names", + "tests": [ + "05/04" + ], + "actions": [ + "insert('\n// filter using `notInList`\nconst unknownStudentList = courses.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\nconst unknownStudentNames = unknownStudentList.map(::>);\n')" + ], + "hints": [ + "use `map` to return only the `student.name`", + "try this inside of your map call: `student => 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\nconst 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\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\"", + "tests": [ + "06/01" + ], + "actions": [ + "writeFromFile('data/courses2.js', '06/courses2.js')", + "open('data/courses2.js')" + ] + }, + { + "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('```\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": "load suspectData. We will come back to this after some practice;", + "tests": [ + "07/01" + ], + "actions": [ + "writeFromFile('data/suspectData.js', '07/suspectData.js')", + "open('data/suspectData.js')" + ] + }, + { + "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')" + ], + "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/03" + ], + "actions": [ + "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", + "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/04" + ], + "actions": [ + "open('07-reduce.js')", + "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]}`", + "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('\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`", + "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\nconst likelySuspects = suspectStats.reduce((::>) => {}, []);\n')" + ], + "hints": [ + "use `.join(', ')`" + ] + }, + { + "description": "It looks like we have a likely suspect.", + "tests": [ + "07/07" + ], + "actions": [ + "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/package.json b/package.json index 227c9d6..6940121 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { "name": "coderoad-functional-school", - "version": "0.1.8", + "version": "1.1.3", "description": "Coderoad tutorial", "author": "Shawn McKay (http://shmck.com)", - "contributers": [], + "contributers": [ + "dimchez" + ], "keywords": [ "coderoad", "tutorial", "functional" ], @@ -20,20 +22,20 @@ "url": "https://github.com/coderoad/coderoad-functional-school/issues" }, "engines": { - "node" : ">=0.10.3" + "node" : ">=4.0.0" }, "dependencies": { "chai": "3.5.0", "chai-spies": "0.7.1", - "lodash": "4.5.1", - "mocha": "2.4.5", - "mocha-coderoad": "^0.4.2" + "mocha": "3.0.2", + "mocha-coderoad": "^0.10.0" }, "license": "MIT", "config": { - "testDir": "tutorial", - "testSuffix": ".spec.js", - "testRunner": "mocha-coderoad", + "language": "JS", + "dir": "tutorial", + "testSuffix": ".js", + "runner": "mocha-coderoad", "edit": true } } diff --git a/tutorial/00/01.js b/tutorial/00/01.js new file mode 100644 index 0000000..a4a802c --- /dev/null +++ b/tutorial/00/01.js @@ -0,0 +1,15 @@ +const chai = require('chai'); +const spies = require('chai-spies'); +const expect = chai.expect; +chai.use(spies); +let spy = chai.spy.on(console, 'log'); + +describe('01 student data', () => { + + const students = require('BASE/data/students.js'); + + it('should be loaded in "data/students.js"', () => { + expect(students).to.not.be.undefined; + }); + +}); diff --git a/tutorial/00/02.js b/tutorial/00/02.js new file mode 100644 index 0000000..89a3510 --- /dev/null +++ b/tutorial/00/02.js @@ -0,0 +1,31 @@ +const setup = require('BASE/setup.js'); + +describe('02 const first', () => { + + // __get__ grabs global first + const first = setup.__get__('first'); + + it('should exist', () => { + expect(first).to.not.be.undefined; + }); + + 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.js b/tutorial/00/03.js new file mode 100644 index 0000000..5d038ff --- /dev/null +++ b/tutorial/00/03.js @@ -0,0 +1,19 @@ +describe('03 const myName', () => { + + // __get__ grabs global myName + const myName = setup.__get__('myName'); + + it('should exist', () => { + expect(myName).to.not.be.undefined; + }); + + 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/data.js b/tutorial/00/data.js new file mode 100644 index 0000000..b0958c2 --- /dev/null +++ b/tutorial/00/data.js @@ -0,0 +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" +}]; +export default students; diff --git a/tutorial/00/setup.md b/tutorial/00/setup.md new file mode 100644 index 0000000..ca9334e --- /dev/null +++ b/tutorial/00/setup.md @@ -0,0 +1,70 @@ +## 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 +``` + ++ 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')) + ++ Set `first` to the first item in the `students` array. +@test('00/02') +@action(open('setup.js')) +@action(set( +``` +// Welcome to CodeRoad! +const students = require('./data/students').default; + +var first = ::> +``` +)) +@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. +@test('00/03') +@action(insert( +``` +var myName = ::> +``` +)) +@hint('Get the first "name" in the students using the array index') +@hint('Access the "name" of `first`') +@hint('Try `first.name`') + ++ Log your name to the console. +@test('00/04') +@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/01/01.js b/tutorial/01/01.js new file mode 100644 index 0000000..359b3fc --- /dev/null +++ b/tutorial/01/01.js @@ -0,0 +1,53 @@ +var expect = require('chai').expect; + +const students = require('BASE/data/students.js'); +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/1/01/02-filter.spec.js b/tutorial/01/02.js similarity index 84% rename from tutorial/1/01/02-filter.spec.js rename to tutorial/01/02.js index a827036..0981fb3 100644 --- a/tutorial/1/01/02-filter.spec.js +++ b/tutorial/01/02.js @@ -1,21 +1,20 @@ -"use strict"; -var expect = require('chai').expect; +describe('02 const 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/1/01/03-filter.spec.js b/tutorial/01/03.js similarity index 63% rename from tutorial/1/01/03-filter.spec.js rename to tutorial/01/03.js index 6d843e7..7074539 100644 --- a/tutorial/1/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/1/01/04-filter.spec.js b/tutorial/01/04.js similarity index 79% rename from tutorial/1/01/04-filter.spec.js rename to tutorial/01/04.js index f3e4f35..dec5342 100644 --- a/tutorial/1/01/04-filter.spec.js +++ b/tutorial/01/04.js @@ -1,21 +1,20 @@ -"use strict"; -var expect = require('chai').expect; +describe('04 const 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/1/01/filter.md b/tutorial/01/filter.md similarity index 74% rename from tutorial/1/01/filter.md rename to tutorial/01/filter.md index 498a5d7..a794154 100644 --- a/tutorial/1/01/filter.md +++ b/tutorial/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. @@ -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,8 +16,8 @@ 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']; +```js +const list = ['a', 'b']; list.filter(isA); // if isA(list[0]), add to output array @@ -28,12 +28,12 @@ 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' } -var list = [{item: 'a'}, {item: 'b'}]; +const list = [{item: 'a'}, {item: 'b'}]; list.filter(isB); //> [{item: 'b'}] ``` @@ -42,8 +42,8 @@ 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]); +```js +console.log(students[0]); //> { course: 'Web Security', // instructor: 'Sue Denim', // name: 'Rebecca Heineman', @@ -52,59 +52,44 @@ 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') +@test('01/01') @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() { - // write condition here +import students from './data/students'; +// 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". -@test('1/01/02-filter') ++ Set `const myData` to filter with the `isAda` function. +@test('01/02') @action(insert( ``` -// call filter condition here -var myData = data.filter(); +// run the function name in filter +const myData = students.filter(::>); ``` )) @hint('Add a function to the `filter` call: `Array.filter(function() {})`') @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') @action(insert( ``` // return true if student.grade is not a "D" or "F" function isGoodGrade(student) { - + ::> } ``` )) @@ -112,15 +97,15 @@ 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('1/01/04-filter') +@test('01/04') @action(insert( ``` // filter out "D"'s and "F"'s here -var myBest = myData.filter(); +const 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/02/01.js b/tutorial/02/01.js new file mode 100644 index 0000000..de49578 --- /dev/null +++ b/tutorial/02/01.js @@ -0,0 +1,11 @@ +const expect = require('chai').expect; + +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/02.js b/tutorial/02/02.js new file mode 100644 index 0000000..c638bb8 --- /dev/null +++ b/tutorial/02/02.js @@ -0,0 +1,26 @@ +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 new file mode 100644 index 0000000..f3322d7 --- /dev/null +++ b/tutorial/02/03.js @@ -0,0 +1,7 @@ +describe('03 function compareScore', () => { + + 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 new file mode 100644 index 0000000..882db54 --- /dev/null +++ b/tutorial/02/04.js @@ -0,0 +1,7 @@ +describe('04 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/05.js b/tutorial/02/05.js new file mode 100644 index 0000000..8edb530 --- /dev/null +++ b/tutorial/02/05.js @@ -0,0 +1,22 @@ +describe('05 const 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/myBest.js b/tutorial/02/myBest.js new file mode 100644 index 0000000..c2148a3 --- /dev/null +++ b/tutorial/02/myBest.js @@ -0,0 +1,44 @@ +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/1/02/sort.md b/tutorial/02/sort.md similarity index 82% rename from tutorial/1/02/sort.md rename to tutorial/02/sort.md index 77afa28..bc358bd 100644 --- a/tutorial/1/02/sort.md +++ b/tutorial/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. @@ -32,16 +32,24 @@ Alright, now time to sort your best grades to the top. First you'll need to write a sort condition function called `compareScore`. ++ look at the data we will work with next: `myBest`. Save to continue. +@test('02/01') +@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('1/02/01-sort') +@test('02/02') @action(open('02-sort.js')) @action(set( ``` +import myBest from './data/myBest'; +// Array.sort(fn) + 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 @@ -53,21 +61,21 @@ function compareScore(a, b) { ``` )) + `compareScore` should return -1 if the first score is more than the second -@test('1/02/02-sort') +@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('1/02/03-sort') +@test('02/04') @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/05') @action(insert( ``` // use the compare function to sort myBest -var mySorted = myBest +const 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/03/01.js b/tutorial/03/01.js new file mode 100644 index 0000000..dd3826f --- /dev/null +++ b/tutorial/03/01.js @@ -0,0 +1,11 @@ +const expect = require('chai').expect; + +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/02.js b/tutorial/03/02.js new file mode 100644 index 0000000..1e8a63a --- /dev/null +++ b/tutorial/03/02.js @@ -0,0 +1,59 @@ +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 `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.not.be.undefined; + }); + + 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/1/03/02-map.spec.js b/tutorial/03/03.js similarity index 59% rename from tutorial/1/03/02-map.spec.js rename to tutorial/03/03.js index edf066a..39328e4 100644 --- a/tutorial/1/03/02-map.spec.js +++ b/tutorial/03/03.js @@ -1,22 +1,23 @@ -var expect = require('chai').expect; +describe('03 const 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/04.js b/tutorial/03/04.js new file mode 100644 index 0000000..a69a2c1 --- /dev/null +++ b/tutorial/03/04.js @@ -0,0 +1,50 @@ +describe('04 function increaseScore', () => { + + const increaseScore = map.__get__('increaseScore'); + + it('doesn\'t exist', () => { + expect(increaseScore).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', () => { + 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', () => { + const test = { + score: 50, + grade: 'D' + }; + expect(increaseScore(test).score).to.equal(62); + }); + +}); + +describe('04 const mySlightlyChanged', () => { + + const mySlightlyChanged = map.__get__('mySlightlyChanged'); + + 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', () => { + 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 new file mode 100644 index 0000000..abbdbcd --- /dev/null +++ b/tutorial/03/05.js @@ -0,0 +1,44 @@ +describe('05 function increaseScore', () => { + + const increaseScore = map.__get__('increaseScore'); + + it('doesn\'t exist', () => { + expect(increaseScore).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('shouldn\'t change scores under 95', () => { + const test = { + score: 82, + grade: 'A', + }; + expect(increaseScore(test).score).to.equal(94); + }); + + it('should change scores over 95 to 95', () => { + const test = { + score: 84, + grade: 'A', + }; + expect(increaseScore(test).score).to.equal(95); + }); + +}); + +describe('05 const mySlightlyChanged', () => { + + const mySlightlyChanged = map.__get__('mySlightlyChanged'); + + it('should cap scores at 95', () => { + 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 new file mode 100644 index 0000000..686c71c --- /dev/null +++ b/tutorial/03/06.js @@ -0,0 +1,30 @@ +describe('06 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('06 const mySlightlyChanged', () => { + + const mySlightlyChanged = map.__get__('mySlightlyChanged'); + + it('doesn\'t update grades correctly', () => { + expect(mySlightlyChanged.map((x) => { + return x.grade; + })).to.deep.equal(['A', 'A', 'C', 'A', 'B', 'C', 'A', 'A', 'A', 'C']); + }); + +}); diff --git a/tutorial/1/03/06-map.spec.js b/tutorial/03/07.js similarity index 53% rename from tutorial/1/03/06-map.spec.js rename to tutorial/03/07.js index a46789f..2b4d0df 100644 --- a/tutorial/1/03/06-map.spec.js +++ b/tutorial/03/07.js @@ -1,8 +1,8 @@ -var expect = require('chai').expect; +describe('07 const 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/1/03/map.md b/tutorial/03/map.md similarity index 58% rename from tutorial/1/03/map.md rename to tutorial/03/map.md index 25f6fed..aba2e91 100644 --- a/tutorial/1/03/map.md +++ b/tutorial/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. @@ -56,63 +56,79 @@ 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. -@test('1/03/01-map') ++ load "myCourses" +@test('03/01') +@action(writeFromFile('data/myCourses.js', '03/myCourses.js')) +@action(open('data/myCourses.js')) + ++ 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( ``` -// change any `student.grade`'s into an 'A' -function changeGrade() { - +import myCourses from './data/myCourses'; +// Array.map(fn) + +/* + * change any the `course.grade` into an 'A' + * + * for example: + * changeGrade({ grade: 'F' }) === { grade: 'A' }; +*/ + +function changeGrade(course) { + ::> } + ``` )) -@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 `changeGrades` function. Set `myChanged` to the result. -@test('1/03/02-map') ++ Map over the `myCourses` with the `changeGrade` function. Set `myChanged` to the result. +@test('03/03') @action(insert( ``` -// map over `myData` with the `changeGrades` 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. -@test('1/03/03-map') +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/04-map') -@hint('use an if clause within `increaseScore`') -@hint('try `if (student.score >= 95) { student.score = 95 }`') +@test('03/05') +@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. -@test('1/03/05-map') ++ 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 an object -// and return an object +// use getGrade to set the course grade +// update `increaseScore` to also update the grade function getGrade(score) { switch (true) { case (score >= 90): @@ -128,24 +144,24 @@ function getGrade(score) { } } -// map `myFixed` to update grades to the new scores -var 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('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('1/03/06-map') +@test('03/07') @action(insert( ``` // 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 = 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/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/04/01.js b/tutorial/04/01.js new file mode 100644 index 0000000..ac49833 --- /dev/null +++ b/tutorial/04/01.js @@ -0,0 +1,19 @@ +const chai = require('chai'); +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', () => { + + it('should be loaded in "data/myFixed.js"', () => { + expect(myFixed).to.not.be.undefined; + }); + +}); diff --git a/tutorial/04/02.js b/tutorial/04/02.js new file mode 100644 index 0000000..698678d --- /dev/null +++ b/tutorial/04/02.js @@ -0,0 +1,12 @@ +require('BASE/04-forEach.js'); + +describe('02 console.log', () => { + + 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/1/04/02-forEach.spec.js b/tutorial/04/03.js similarity index 66% rename from tutorial/1/04/02-forEach.spec.js rename to tutorial/04/03.js index 9a775a7..7cee4bb 100644 --- a/tutorial/1/04/02-forEach.spec.js +++ b/tutorial/04/03.js @@ -1,9 +1,7 @@ -'use strict'; - -describe('02 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 A 95 Relational Databases'); expect(spy).to.have.been.called.with('10 C 77 Networks'); }); diff --git a/tutorial/1/04/03-forEach.spec.js b/tutorial/04/04.js similarity index 70% rename from tutorial/1/04/03-forEach.spec.js rename to tutorial/04/04.js index f5753d8..c61b2f9 100644 --- a/tutorial/1/04/03-forEach.spec.js +++ b/tutorial/04/04.js @@ -1,7 +1,7 @@ -describe('03 console.log', function() { +describe('04 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/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/1/04/forEach.md b/tutorial/04/forEach.md similarity index 87% rename from tutorial/1/04/forEach.md rename to tutorial/04/forEach.md index ce919dc..dcc2550 100644 --- a/tutorial/1/04/forEach.md +++ b/tutorial/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. @@ -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; @@ -86,28 +86,36 @@ function addOneToLog(x) { Now that we see how `forEach` works, let's use it to make calls to the `console`. ++ 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')) + + Use `forEach` to log out your report card to the console -@test('1/04/01-forEach') +@test('04/02') @action(open('04-forEach.js')) @action(set( ``` +import myFixed from './data/myFixed'; +// Array.forEach(fn) + function logCourse(course) { console.log(`${course.grade} ${course.score} ${course.title}`); } // log your grades to the console -myFixed.forEach(); +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/03') @action(insert( ``` // 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}`); } @@ -119,12 +127,12 @@ 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/04') @action(insert( ``` // 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}`); } @@ -150,11 +158,12 @@ 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') +@test('04/05') @action(insert( ``` console.log(myFixed); ``` )) + +@onPageComplete('Something strange is going on. In the next step we'll try to `find` your data.') diff --git a/tutorial/04/myFixed.js b/tutorial/04/myFixed.js new file mode 100644 index 0000000..97299a0 --- /dev/null +++ b/tutorial/04/myFixed.js @@ -0,0 +1,62 @@ +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/01.js b/tutorial/05/01.js new file mode 100644 index 0000000..c312582 --- /dev/null +++ b/tutorial/05/01.js @@ -0,0 +1,11 @@ +const expect = require('chai').expect; + +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/02.js b/tutorial/05/02.js new file mode 100644 index 0000000..4801c40 --- /dev/null +++ b/tutorial/05/02.js @@ -0,0 +1,11 @@ +const find = require('BASE/05-find.js'); + +describe('02 const myClass', () => { + + const myClass = find.__get__('myClass'); + + it('should filter to "Web Security" class data', () => { + expect(myClass).to.have.length(16); + }); + +}); diff --git a/tutorial/05/03.js b/tutorial/05/03.js new file mode 100644 index 0000000..525d0c1 --- /dev/null +++ b/tutorial/05/03.js @@ -0,0 +1,23 @@ +describe('03 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('03 const 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 new file mode 100644 index 0000000..29c857d --- /dev/null +++ b/tutorial/05/04.js @@ -0,0 +1,14 @@ +describe('04 const 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) => student.name).join(''); + expect(names).to.equal('!findthebestrevenge!'); + }); + +}); diff --git a/tutorial/05/05.js b/tutorial/05/05.js new file mode 100644 index 0000000..774fc3e --- /dev/null +++ b/tutorial/05/05.js @@ -0,0 +1,10 @@ +describe('05 const 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/06.js b/tutorial/05/06.js new file mode 100644 index 0000000..d34b39e --- /dev/null +++ b/tutorial/05/06.js @@ -0,0 +1,9 @@ +describe('06 const decodedName', () => { + + const decodedName = find.__get__('decodedName'); + + it('should find 10 unknown students names', () => { + expect(decodedName).to.equal('!findthebestrevenge!'); + }); + +}); diff --git a/tutorial/05/courses.js b/tutorial/05/courses.js new file mode 100644 index 0000000..f1c8afd --- /dev/null +++ b/tutorial/05/courses.js @@ -0,0 +1,962 @@ +const courses = [{ + 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 courses; diff --git a/tutorial/1/05/find.md b/tutorial/05/find.md similarity index 53% rename from tutorial/1/05/find.md rename to tutorial/05/find.md index 84c83bc..71f8496 100644 --- a/tutorial/1/05/find.md +++ b/tutorial/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. @@ -7,8 +7,8 @@ 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]; +```js +const data = [1, 2, 3, 4, 5, 6]; function isEven(num) { return num % 2 === 0; @@ -25,24 +25,33 @@ 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') ++ load "students" data. Save to continue. +@test('05/01') +@action(writeFromFile('data/myCourses2.js', '05/courses.js')) +@action(open('data/myCourses2.js')) + ++ `filter` to `courses` in the class titled "Web Security" +@test('05/02') @action(open('05-find.js')) @action(set( ``` -// filter for the student title matches "Web Security" -var myClass = students.filter(); +import courses from './data/myCourses2'; +// Array.find(fn) + +// 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('1/05/02-find') +@test('05/03') @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"]; ``` )) @@ -50,51 +59,51 @@ 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(::>) { } // find using `notInList` -var unknownStudent = myClass.find(); +const unknownStudent = myClass.find(); ``` )) @hint('use `indexOf` to find what doesn't match') @hint('use `otherStudents.indexOf(x) === -1` to find what doesn't match') @hint('match for `student.name`') -+ `filter` down to students without known names -@test('1/05/03-find') ++ `filter` down to students from courses without known names +@test('05/04') @action(insert( ``` // filter using `notInList` -var unknownStudentList = students.filter(); +const unknownStudentList = courses.filter(::>); ``` )) @hint('consider reusing a function') + `map` over the result to get only the `name` property -@test('1/05/04-find') +@test('05/05') @action(insert( ``` // list only student names -var unknownStudentNames = unknownStudentList.map(); +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('1/05/05-find') +@test('05/06') @action(insert( ``` // use `.join('')` to join the array of strings -var decodedName = unknownStudentNames; +const decodedName = unknownStudentNames::>; 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/06/01.js b/tutorial/06/01.js new file mode 100644 index 0000000..2dfdedb --- /dev/null +++ b/tutorial/06/01.js @@ -0,0 +1,11 @@ +const expect = require('chai').expect; + +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/02.js b/tutorial/06/02.js new file mode 100644 index 0000000..709ffc6 --- /dev/null +++ b/tutorial/06/02.js @@ -0,0 +1,15 @@ +const concat = require('BASE/06-concat.js'); + +describe('02 const 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/1/06/02-concat.spec.js b/tutorial/06/03.js similarity index 60% rename from tutorial/1/06/02-concat.spec.js rename to tutorial/06/03.js index f2c0f1b..3f0e7fc 100644 --- a/tutorial/1/06/02-concat.spec.js +++ b/tutorial/06/03.js @@ -1,11 +1,13 @@ -describe('02 var doubleArray', function() { +describe('03 const 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/1/06/03-concat.spec.js b/tutorial/06/04.js similarity index 55% rename from tutorial/1/06/03-concat.spec.js rename to tutorial/06/04.js index 85d86ae..33b1391 100644 --- a/tutorial/1/06/03-concat.spec.js +++ b/tutorial/06/04.js @@ -1,10 +1,12 @@ -describe('03 var students', function() { +describe('04 const 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/1/06/04-concat.spec.js b/tutorial/06/05.js similarity index 66% rename from tutorial/1/06/04-concat.spec.js rename to tutorial/06/05.js index dc460e4..43b5331 100644 --- a/tutorial/1/06/04-concat.spec.js +++ b/tutorial/06/05.js @@ -1,11 +1,13 @@ -describe('04 var suspectData', function() { +describe('05 const 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/1/06/05-concat.spec.js b/tutorial/06/06.js similarity index 55% rename from tutorial/1/06/05-concat.spec.js rename to tutorial/06/06.js index b400176..34d5b48 100644 --- a/tutorial/1/06/05-concat.spec.js +++ b/tutorial/06/06.js @@ -1,27 +1,31 @@ -describe('05 var newSuspects', function() { +describe('06 const 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('06 const 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/1/06/concat.md b/tutorial/06/concat.md similarity index 76% rename from tutorial/1/06/concat.md rename to tutorial/06/concat.md index edf0244..d95f2bc 100644 --- a/tutorial/1/06/concat.md +++ b/tutorial/06/concat.md @@ -1,4 +1,4 @@ -### concat +## concat Array + Array -> Array Before we've been working on a structured set of student data. @@ -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}] ``` @@ -95,26 +95,32 @@ 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. ++ load "courses" +@test('06/01') +@action(writeFromFile('data/courses2.js', '06/courses2.js')) +@action(open('data/courses2.js')) + + First, test out `flatten` on the `flattenedArray` -@test('1/06/01-concat') +@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 Array.prototype.flatten = function() { - return this.reduce(function(a, b) { - return a.concat(b); - }, []); + return this.reduce((a, b) => a.concat(b), []); }; ``` )) @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`') @@ -128,17 +134,17 @@ Return the fields: * name * grade * score -@test('1/06/02-concat') +@test('06/03') @action(insert( ``` // map over courses then // map over students inside of courses -var 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: '', + title: ::>'', instructor: '', name: '', score: '', @@ -153,33 +159,35 @@ 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/04') @action(insert( ``` // `flatten` doubleArray -var students = doubleArray; +const students = doubleArray::>; ``` )) @hint('call `.flatten()` on `doubleArray`') -+ Use the `suspects` array to `filter` to only "Hack Kerr"'s data -@test('1/06/04-concat') ++ Use the `suspects` array to `filter` to only data matching the names in the `suspects` array +@test('06/05') @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. -@test('1/06/05-concat') +@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/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/01.js b/tutorial/07/01.js new file mode 100644 index 0000000..0c2740c --- /dev/null +++ b/tutorial/07/01.js @@ -0,0 +1,11 @@ +const expect = require('chai').expect; + +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 new file mode 100644 index 0000000..095db46 --- /dev/null +++ b/tutorial/07/02.js @@ -0,0 +1,11 @@ +const reduce = require('BASE/07-reduce.js'); + +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 new file mode 100644 index 0000000..8238e71 --- /dev/null +++ b/tutorial/07/03.js @@ -0,0 +1,9 @@ +describe('03 const 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/1/07/03-reduce.spec.js b/tutorial/07/04.js similarity index 67% rename from tutorial/1/07/03-reduce.spec.js rename to tutorial/07/04.js index ad6695c..1f26d52 100644 --- a/tutorial/1/07/03-reduce.spec.js +++ b/tutorial/07/04.js @@ -1,6 +1,8 @@ -describe('03 var suspectScores', function() { +describe('04 const 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/1/07/04-reduce.spec.js b/tutorial/07/05.js similarity index 80% rename from tutorial/1/07/04-reduce.spec.js rename to tutorial/07/05.js index e3fe6a8..8676abd 100644 --- a/tutorial/1/07/04-reduce.spec.js +++ b/tutorial/07/05.js @@ -1,6 +1,8 @@ -describe('04 var suspectStats', function() { +describe('05 const 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/06.js b/tutorial/07/06.js new file mode 100644 index 0000000..2c10689 --- /dev/null +++ b/tutorial/07/06.js @@ -0,0 +1,9 @@ +describe('06 const 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/07.js b/tutorial/07/07.js new file mode 100644 index 0000000..a8ed991 --- /dev/null +++ b/tutorial/07/07.js @@ -0,0 +1,7 @@ +describe('07 const likelySuspects', () => { + + it('should pass', () => { + expect(true).to.be.true; + }); + +}); diff --git a/tutorial/1/07/reduce.md b/tutorial/07/reduce.md similarity index 80% rename from tutorial/1/07/reduce.md rename to tutorial/07/reduce.md index 0de9f43..acee202 100644 --- a/tutorial/1/07/reduce.md +++ b/tutorial/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. @@ -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 @@ -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,20 +45,27 @@ 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. ++ 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')) + Use `reduce` to sum the numbers in the `practice` array -@test('1/07/01-reduce') +@test('07/02') @action(open('07-reduce.js')) @action(set( ``` -var practice = [1, 1, 2, 3, 5, 8, 13, 21]; +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 -var total = practice.reduce(); +const total = practice.reduce(::>); ``` )) @hint('with only numbers, the initialValue defaults to 0') @@ -69,13 +74,13 @@ 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/03') @action(insert( ``` -var averages = courses.map(function(course) { - var sum = course.students.reduce(function(total, student) { - +const averages = courses.map((course) => { + const sum = course.students.reduce((total, student) => { + ::> }); return Math.round(sum / course.students.length, 0); @@ -86,21 +91,19 @@ var averages = courses.map(function(course) { @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('1/07/03-reduce') +@test('07/04') +@action(open('07-reduce.js')) @action(insert( ``` // [{ name: 'suspectName', scores: [ 50, 65, 75, 85...] } ...] -var suspectScores = suspectData.reduce(function(total, next) { +const suspectScores = suspectData.reduce((total, next) => { // see if suspect name has a list yet - var index = total.findIndex(function(suspect) { - return suspect.name === next.name; - }); + const index = total.findIndex((suspect) => suspect.name === next.name); if (index < 0) { total.push({ - + ::> }); } else { @@ -125,13 +128,13 @@ var suspectScores = suspectData.reduce(function(total, next) { difference: 15 }] ``` -@test('1/07/04-reduce') +@test('07/05') @action(insert( ``` -var suspectStats = suspectScores.map(function(suspect) { +const suspectStats = suspectScores.map((suspect) => { // calculate the total difference in scores from the averages - var difference = suspect.scores.reduce(); + const difference = suspect.scores.reduce(::>); return { name: suspect.name, @@ -149,7 +152,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/06') @action(insert( ``` @@ -158,13 +161,13 @@ function isCheater(suspect) { } // reduce down to a string of likely suspects -var likelySuspects = suspectStats.reduce(function() {}, []); +const likelySuspects = suspectStats.reduce((::>) => {}, []); ``` )) @hint('use `.join(', ')`') + It looks like we have a likely suspect. -@test('1/07/06-reduce') +@test('07/07') @action(insert( ``` console.log(likelySuspects); diff --git a/tutorial/07/suspectData.js b/tutorial/07/suspectData.js new file mode 100644 index 0000000..180fddb --- /dev/null +++ b/tutorial/07/suspectData.js @@ -0,0 +1,182 @@ +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/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 82% rename from tutorial/1/08/challenge-1.md rename to tutorial/08/challenge-1.md index 682fad5..9b12ff6 100644 --- a/tutorial/1/08/challenge-1.md +++ b/tutorial/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/09/challenge-2.md similarity index 70% rename from tutorial/1/09/challenge-2.md rename to tutorial/09/challenge-2.md index fd69fea..56e6e78 100644 --- a/tutorial/1/09/challenge-2.md +++ b/tutorial/09/challenge-2.md @@ -1,4 +1,4 @@ -### Challenge 2 +## Challenge 2 coming soon It's time to get revenge. diff --git a/tutorial/1/01/01-filter.spec.js b/tutorial/1/01/01-filter.spec.js deleted file mode 100644 index 951b8a4..0000000 --- a/tutorial/1/01/01-filter.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; - -if (!global.data) { - global.data = JSON.parse(JSON.stringify(require('./data/students.json'))); -} - -loadJS('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/1/02/01-sort.spec.js b/tutorial/1/02/01-sort.spec.js deleted file mode 100644 index f27dd82..0000000 --- a/tutorial/1/02/01-sort.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; -if (!global.myBest) { - global.myBest = JSON.parse(JSON.stringify(require('./1/02/myBest.json'))); -} -loadJS('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/1/02/02-sort.spec.js deleted file mode 100644 index c98f2b2..0000000 --- a/tutorial/1/02/02-sort.spec.js +++ /dev/null @@ -1,5 +0,0 @@ -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); - }); -}); diff --git a/tutorial/1/02/03-sort.spec.js b/tutorial/1/02/03-sort.spec.js deleted file mode 100644 index e9799d5..0000000 --- a/tutorial/1/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/1/02/04-sort.spec.js b/tutorial/1/02/04-sort.spec.js deleted file mode 100644 index aa5e208..0000000 --- a/tutorial/1/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/1/02/myBest.json b/tutorial/1/02/myBest.json deleted file mode 100644 index 4086748..0000000 --- a/tutorial/1/02/myBest.json +++ /dev/null @@ -1,43 +0,0 @@ -[{ - "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/01-map.spec.js b/tutorial/1/03/01-map.spec.js deleted file mode 100644 index 66c2eeb..0000000 --- a/tutorial/1/03/01-map.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; -if (!global.myData) { - global.myData = JSON.parse(JSON.stringify(require('./1/03/myData.json'))); -} -loadJS('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/03-map.spec.js b/tutorial/1/03/03-map.spec.js deleted file mode 100644 index 4df3ac7..0000000 --- a/tutorial/1/03/03-map.spec.js +++ /dev/null @@ -1,51 +0,0 @@ -var expect = require('chai').expect; - -describe('03 function increaseScore', function() { - - it('doesn\'t exist', function() { - expect(increaseScore).to.not.be.undefined; - }); - - it('should be a function', function() { - expect(increaseScore).to.be.a('function'); - }); - - it('should take a parameter', function() { - expect(increaseScore).to.have.length(1); - }); - - it('should try changing the `score` first before returning the changed object', function() { - 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() { - var test = { - score: 50 - }; - expect(increaseScore(test)).to.deep.equal({ - score: 62 - }); - }); - -}); - -describe('03 var mySlightlyChanged', function() { - - it('doesn\'t exist', function() { - expect(mySlightlyChanged).to.not.be.undefined; - }); - - it('isn\'t an array', function() { - expect(mySlightlyChanged).to.be.an('array'); - }); - - it('should increment scores by 12', function() { - var scores = mySlightlyChanged.map(function(x) { - return x.score; - }); - expect(Math.min.apply(Math, scores)).to.equal(70); - }); - -}); diff --git a/tutorial/1/03/04-map.spec.js b/tutorial/1/03/04-map.spec.js deleted file mode 100644 index f7e095a..0000000 --- a/tutorial/1/03/04-map.spec.js +++ /dev/null @@ -1,46 +0,0 @@ -var expect = require('chai').expect; - -describe('04 function increaseScore', function() { - - it('doesn\'t exist', function() { - expect(increaseScore).to.not.be.undefined; - }); - - it('should be a function', function() { - expect(increaseScore).to.be.a('function'); - }); - - it('should take a parameter', function() { - expect(increaseScore).to.have.length(1); - }); - - it('shouldn\'t change scores under 95', function() { - var test = { - score: 82 - }; - expect(increaseScore(test)).to.deep.equal({ - score: 94 - }); - }); - - it('should change scores over 95 to 95', function() { - var test = { - score: 84 - }; - expect(increaseScore(test)).to.deep.equal({ - score: 95 - }); - }); - -}); - -describe('04 var mySlightlyChanged', function() { - - it('should cap scores at 95', function() { - var scores = mySlightlyChanged.map(function(x) { - return x.score; - }); - expect(Math.max.apply(Math, scores)).to.equal(95); - }); - -}); diff --git a/tutorial/1/03/05-map.spec.js b/tutorial/1/03/05-map.spec.js deleted file mode 100644 index 41866de..0000000 --- a/tutorial/1/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/1/03/myData.json b/tutorial/1/03/myData.json deleted file mode 100644 index 8b795e5..0000000 --- a/tutorial/1/03/myData.json +++ /dev/null @@ -1,61 +0,0 @@ -[{ - "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/01-forEach.spec.js b/tutorial/1/04/01-forEach.spec.js deleted file mode 100644 index 9eb73c5..0000000 --- a/tutorial/1/04/01-forEach.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -var chai = require('chai'); -var spies = require('chai-spies'); -var expect = chai.expect; -chai.use(spies); -var path = require('path'); -var loadJS = require('./common/loadJS').default; - -global.myFixed = JSON.parse(JSON.stringify(require('./1/04/myFixed.json'))); - -if (process.env.TASK_POSITION === '4') { - global.myFixed = []; -} - -var spy = chai.spy.on(console, 'log'); -loadJS('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/04-forEach.spec.js b/tutorial/1/04/04-forEach.spec.js deleted file mode 100644 index 5d31f13..0000000 --- a/tutorial/1/04/04-forEach.spec.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var expect = require('chai').expect; - -describe('04 log', function() { - - it('should pass', function () { - expect(true).to.be.true; - }); - -}); 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/05/01-find.spec.js b/tutorial/1/05/01-find.spec.js deleted file mode 100644 index 4c5036b..0000000 --- a/tutorial/1/05/01-find.spec.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; -var expect = require('chai').expect; -var spies = require('chai-spies'); -var loadJS = require('./common/loadJS').default; - -if (!global.students) { - global.students = JSON.parse(JSON.stringify(require('./data/students2.json'))); -} -loadJS('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/1/05/02-find.spec.js b/tutorial/1/05/02-find.spec.js deleted file mode 100644 index 560327b..0000000 --- a/tutorial/1/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/1/05/03-find.spec.js b/tutorial/1/05/03-find.spec.js deleted file mode 100644 index 0e5b60b..0000000 --- a/tutorial/1/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/1/05/04-find.spec.js b/tutorial/1/05/04-find.spec.js deleted file mode 100644 index 1636dcc..0000000 --- a/tutorial/1/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/1/05/05-find.spec.js b/tutorial/1/05/05-find.spec.js deleted file mode 100644 index ac1167b..0000000 --- a/tutorial/1/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/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/06/01-concat.spec.js b/tutorial/1/06/01-concat.spec.js deleted file mode 100644 index c6ce5c4..0000000 --- a/tutorial/1/06/01-concat.spec.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; -var expect = require('chai').expect; -var loadJS = require('./common/loadJS').default; - -if (!global.courses) { - global.courses = JSON.parse(JSON.stringify(require('./data/courses2.json'))); -} - -loadJS('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/1/07/01-reduce.spec.js b/tutorial/1/07/01-reduce.spec.js deleted file mode 100644 index e32e40b..0000000 --- a/tutorial/1/07/01-reduce.spec.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -var expect = require('chai').expect; -var loadJS = require('./common/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'))); -} - -loadJS('07-reduce.js'); - -describe('01 var total', function() { - - it('should add the numbers up', function () { - expect(total).to.equal(54); - }); - -}); diff --git a/tutorial/1/07/02-reduce.spec.js b/tutorial/1/07/02-reduce.spec.js deleted file mode 100644 index a9689e8..0000000 --- a/tutorial/1/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/1/07/05-reduce.spec.js b/tutorial/1/07/05-reduce.spec.js deleted file mode 100644 index b0e2cb6..0000000 --- a/tutorial/1/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/1/07/06-reduce.spec.js b/tutorial/1/07/06-reduce.spec.js deleted file mode 100644 index e92eb94..0000000 --- a/tutorial/1/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/1/07/suspectData.json b/tutorial/1/07/suspectData.json deleted file mode 100644 index db363ab..0000000 --- a/tutorial/1/07/suspectData.json +++ /dev/null @@ -1 +0,0 @@ -[{"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/common/loadJS.js b/tutorial/common/loadJS.js deleted file mode 100644 index 741a139..0000000 --- a/tutorial/common/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; diff --git a/tutorial/data/courses.js b/tutorial/data/courses.js new file mode 100644 index 0000000..43b11b3 --- /dev/null +++ b/tutorial/data/courses.js @@ -0,0 +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"}]}]; diff --git a/tutorial/data/courses.json b/tutorial/data/courses.json deleted file mode 100644 index d68752d..0000000 --- a/tutorial/data/courses.json +++ /dev/null @@ -1,12 +0,0 @@ -[ -{ "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 new file mode 100644 index 0000000..6b92a94 --- /dev/null +++ b/tutorial/data/courses2.js @@ -0,0 +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"}]}]; diff --git a/tutorial/data/courses2.json b/tutorial/data/courses2.json deleted file mode 100644 index 6dcc6d8..0000000 --- a/tutorial/data/courses2.json +++ /dev/null @@ -1,12 +0,0 @@ -[ -{ "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 new file mode 100644 index 0000000..8565659 --- /dev/null +++ b/tutorial/data/students.js @@ -0,0 +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"}]; diff --git a/tutorial/data/students.json b/tutorial/data/students.json deleted file mode 100644 index 70c1951..0000000 --- a/tutorial/data/students.json +++ /dev/null @@ -1,961 +0,0 @@ -[{ - "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 new file mode 100644 index 0000000..eb814fc --- /dev/null +++ b/tutorial/data/students2.js @@ -0,0 +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"}]; diff --git a/tutorial/data/students2.json b/tutorial/data/students2.json deleted file mode 100644 index fb51457..0000000 --- a/tutorial/data/students2.json +++ /dev/null @@ -1,961 +0,0 @@ -[{ - "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" -}] 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