diff --git a/challenges/02-javascript-algorithms-and-data-structures/es6.json b/challenges/02-javascript-algorithms-and-data-structures/es6.json index a77bf08df..6982417ed 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/es6.json +++ b/challenges/02-javascript-algorithms-and-data-structures/es6.json @@ -26,19 +26,15 @@ "tests": [ { "text": "var does not exist in code.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" }, { "text": "catName should be Oliver.", - "testString": - "assert(catName === \"Oliver\", 'catName should be Oliver.');" + "testString": "assert(catName === \"Oliver\", 'catName should be Oliver.');" }, { - "text": - "quote should be \"Oliver says Meow!\"", - "testString": - "assert(quote === \"Oliver says Meow!\", 'quote should be \"Oliver says Meow!\"');" + "text": "quote should be \"Oliver says Meow!\"", + "testString": "assert(quote === \"Oliver says Meow!\", 'quote should be \"Oliver says Meow!\"');" } ], "releasedOn": "Feb 17, 2017", @@ -88,19 +84,15 @@ "tests": [ { "text": "var does not exist in code.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" }, { - "text": - "The variable i declared in the if statement should equal \"block scope\".", - "testString": - "getUserInput => assert(getUserInput('index').match(/(i\\s*=\\s*).*\\s*.*\\s*.*\\1('|\")block\\s*scope\\2/g), 'The variable i declared in the if statement should equal \"block scope\".');" + "text": "The variable i declared in the if statement should equal \"block scope\".", + "testString": "getUserInput => assert(getUserInput('index').match(/(i\\s*=\\s*).*\\s*.*\\s*.*\\1('|\")block\\s*scope\\2/g), 'The variable i declared in the if statement should equal \"block scope\".');" }, { "text": "checkScope() should return \"function scope\"", - "testString": - "assert(checkScope() === \"function scope\", 'checkScope() should return \"function scope\"');" + "testString": "assert(checkScope() === \"function scope\", 'checkScope() should return \"function scope\"');" } ], "releasedOn": "Feb 17, 2017", @@ -142,25 +134,19 @@ "tests": [ { "text": "var does not exist in your code.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in your code.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in your code.');" }, { - "text": - "SENTENCE should be a constant variable declared with const.", - "testString": - "getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g), 'SENTENCE should be a constant variable declared with const.');" + "text": "SENTENCE should be a constant variable declared with const.", + "testString": "getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g), 'SENTENCE should be a constant variable declared with const.');" }, { "text": "i should be declared with let.", - "testString": - "getUserInput => assert(getUserInput('index').match(/(let i)/g), 'i should be declared with let.');" + "testString": "getUserInput => assert(getUserInput('index').match(/(let i)/g), 'i should be declared with let.');" }, { - "text": - "console.log should be changed to print the SENTENCE variable.", - "testString": - "getUserInput => assert(getUserInput('index').match(/console\\.log\\(\\s*SENTENCE\\s*\\)\\s*;?/g), 'console.log should be adjusted to print the variable SENTENCE.');" + "text": "console.log should be changed to print the SENTENCE variable.", + "testString": "getUserInput => assert(getUserInput('index').match(/console\\.log\\(\\s*SENTENCE\\s*\\)\\s*;?/g), 'console.log should be adjusted to print the variable SENTENCE.');" } ], "releasedOn": "Feb 17, 2017", @@ -207,24 +193,19 @@ "tests": [ { "text": "Do not replace const keyword.", - "testString": - "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" + "testString": "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" }, { - "text": - "s should be a constant variable (by using const).", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+s/g), 's should be a constant variable (by using const).');" + "text": "s should be a constant variable (by using const).", + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+s/g), 's should be a constant variable (by using const).');" }, { "text": "Do not change the original array declaration.", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+s\\s*=\\s*\\[\\s*5\\s*,\\s*7\\s*,\\s*2\\s*\\]\\s*;?/g), 'Do not change the original array declaration.');" + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+s\\s*=\\s*\\[\\s*5\\s*,\\s*7\\s*,\\s*2\\s*\\]\\s*;?/g), 'Do not change the original array declaration.');" }, { "text": "s should be equal to [2, 5, 7].", - "testString": - "assert.deepEqual(s, [2, 5, 7], 's should be equal to [2, 5, 7].');" + "testString": "assert.deepEqual(s, [2, 5, 7], 's should be equal to [2, 5, 7].');" } ], "releasedOn": "Feb 17, 2017", @@ -265,24 +246,19 @@ "tests": [ { "text": "Do not replace const keyword.", - "testString": - "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" + "testString": "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" }, { - "text": - "MATH_CONSTANTS should be a constant variable (by using const).", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS/g), 'MATH_CONSTANTS should be a constant variable (by using const).');" + "text": "MATH_CONSTANTS should be a constant variable (by using const).", + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS/g), 'MATH_CONSTANTS should be a constant variable (by using const).');" }, { "text": "Do not change original MATH_CONSTANTS.", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS\\s+=\\s+{\\s+PI:\\s+3.14\\s+};/g), 'Do not change original MATH_CONSTANTS.');" + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS\\s+=\\s+{\\s+PI:\\s+3.14\\s+};/g), 'Do not change original MATH_CONSTANTS.');" }, { "text": "PI equals 3.14.", - "testString": - "assert(PI === 3.14, 'PI equals 3.14.');" + "testString": "assert(PI === 3.14, 'PI equals 3.14.');" } ], "releasedOn": "Aug 12, 2017", @@ -335,29 +311,23 @@ "tests": [ { "text": "User did replace var keyword.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" }, { - "text": - "magic should be a constant variable (by using const).", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+magic/g), 'magic should be a constant variable (by using const).');" + "text": "magic should be a constant variable (by using const).", + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+magic/g), 'magic should be a constant variable (by using const).');" }, { "text": "magic is a function.", - "testString": - "assert(typeof magic === 'function', 'magic is a function.');" + "testString": "assert(typeof magic === 'function', 'magic is a function.');" }, { "text": "magic() returns correct date.", - "testString": - "assert(magic().getDate() == new Date().getDate(), 'magic() returns correct date.');" + "testString": "assert(magic().getDate() == new Date().getDate(), 'magic() returns correct date.');" }, { "text": "function keyword was not used.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" } ], "releasedOn": "Feb 17, 2017", @@ -392,30 +362,23 @@ "tests": [ { "text": "User did replace var keyword.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" }, { - "text": - "myConcat should be a constant variable (by using const).", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+myConcat/g), 'myConcat should be a constant variable (by using const).');" + "text": "myConcat should be a constant variable (by using const).", + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+myConcat/g), 'myConcat should be a constant variable (by using const).');" }, { "text": "myConcat should be a function", - "testString": - "assert(typeof myConcat === 'function', 'myConcat should be a function');" + "testString": "assert(typeof myConcat === 'function', 'myConcat should be a function');" }, { - "text": - "myConcat() returns the correct array", - "testString": - "assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, 'myConcat() returns the correct array');" + "text": "myConcat() returns the correct array", + "testString": "assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, 'myConcat() returns the correct array');" }, { "text": "function keyword was not used.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" } ], "releasedOn": "Feb 17, 2017", @@ -456,42 +419,31 @@ "tests": [ { "text": "User did replace var keyword.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" }, { - "text": - "squaredIntegers should be a constant variable (by using const).", - "testString": - "getUserInput => assert(getUserInput('index').match(/const\\s+squaredIntegers/g), 'squaredIntegers should be a constant variable (by using const).');" + "text": "squaredIntegers should be a constant variable (by using const).", + "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+squaredIntegers/g), 'squaredIntegers should be a constant variable (by using const).');" }, { - "text": - "squaredIntegers should be an array", - "testString": - "assert(Array.isArray(squaredIntegers), 'squaredIntegers should be an array');" + "text": "squaredIntegers should be an array", + "testString": "assert(Array.isArray(squaredIntegers), 'squaredIntegers should be an array');" }, { - "text": - "squaredIntegers should be [16, 1764, 36]", - "testString": - "assert(squaredIntegers[0] === 16 && squaredIntegers[1] === 1764 && squaredIntegers[2] === 36, 'squaredIntegers should be [16, 1764, 36]');" + "text": "squaredIntegers should be [16, 1764, 36]", + "testString": "assert(squaredIntegers[0] === 16 && squaredIntegers[1] === 1764 && squaredIntegers[2] === 36, 'squaredIntegers should be [16, 1764, 36]');" }, { "text": "function keyword was not used.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" }, { "text": "loop should not be used", - "testString": - "getUserInput => assert(!getUserInput('index').match(/(for)|(while)/g), 'loop should not be used');" + "testString": "getUserInput => assert(!getUserInput('index').match(/(for)|(while)/g), 'loop should not be used');" }, { - "text": - "map, filter, or reduce should be used", - "testString": - "getUserInput => assert(getUserInput('index').match(/map|filter|reduce/g), 'map, filter, or reduce should be used');" + "text": "map, filter, or reduce should be used", + "testString": "getUserInput => assert(getUserInput('index').match(/map|filter|reduce/g), 'map, filter, or reduce should be used');" } ], "releasedOn": "Feb 17, 2017", @@ -533,22 +485,16 @@ ], "tests": [ { - "text": - "The result of increment(5, 2) should be 7.", - "testString": - "assert(increment(5, 2) === 7, 'The result of increment(5, 2) should be 7.');" + "text": "The result of increment(5, 2) should be 7.", + "testString": "assert(increment(5, 2) === 7, 'The result of increment(5, 2) should be 7.');" }, { - "text": - "The result of increment(5) should be 6.", - "testString": - "assert(increment(5) === 6, 'The result of increment(5) should be 6.');" + "text": "The result of increment(5) should be 6.", + "testString": "assert(increment(5) === 6, 'The result of increment(5) should be 6.');" }, { - "text": - "default parameter 1 was used for value.", - "testString": - "getUserInput => assert(getUserInput('index').match(/value\\s*=\\s*1/g), 'default parameter 1 was used for value.');" + "text": "default parameter 1 was used for value.", + "testString": "getUserInput => assert(getUserInput('index').match(/value\\s*=\\s*1/g), 'default parameter 1 was used for value.');" } ], "releasedOn": "Feb 17, 2017", @@ -588,29 +534,23 @@ "tests": [ { "text": "The result of sum(0,1,2) should be 3", - "testString": - "assert(sum(0,1,2) === 3, 'The result of sum(0,1,2) should be 3');" + "testString": "assert(sum(0,1,2) === 3, 'The result of sum(0,1,2) should be 3');" }, { "text": "The result of sum(1,2,3,4) should be 10", - "testString": - "assert(sum(1,2,3,4) === 10, 'The result of sum(1,2,3,4) should be 10');" + "testString": "assert(sum(1,2,3,4) === 10, 'The result of sum(1,2,3,4) should be 10');" }, { "text": "The result of sum(5) should be 5", - "testString": - "assert(sum(5) === 5, 'The result of sum(5) should be 5');" + "testString": "assert(sum(5) === 5, 'The result of sum(5) should be 5');" }, { "text": "The result of sum() should be 0", - "testString": - "assert(sum() === 0, 'The result of sum() should be 0');" + "testString": "assert(sum() === 0, 'The result of sum() should be 0');" }, { - "text": - "The sum function uses the ... spread operator on the args parameter.", - "testString": - "getUserInput => assert(getUserInput('index').match(/function\\s+sum\\s*\\(\\s*...args\\s*\\)\\s*{/g), 'The sum function uses the ... spread operator on the args parameter.');" + "text": "The sum function uses the ... spread operator on the args parameter.", + "testString": "getUserInput => assert(getUserInput('index').match(/function\\s+sum\\s*\\(\\s*...args\\s*\\)\\s*{/g), 'The sum function uses the ... spread operator on the args parameter.');" } ], "releasedOn": "Feb 17, 2017", @@ -655,20 +595,15 @@ "tests": [ { "text": "arr2 is correct copy of arr1.", - "testString": - "assert(arr2.every((v, i) => v === arr1[i]), 'arr2 is correct copy of arr1.');" + "testString": "assert(arr2.every((v, i) => v === arr1[i]), 'arr2 is correct copy of arr1.');" }, { - "text": - "... spread operator was used to duplicate arr1.", - "testString": - "getUserInput => assert(getUserInput('index').match(/\\[\\s*...arr1\\s*\\]/g),'... spread operator was used to duplicate arr1.');" + "text": "... spread operator was used to duplicate arr1.", + "testString": "getUserInput => assert(getUserInput('index').match(/\\[\\s*...arr1\\s*\\]/g),'... spread operator was used to duplicate arr1.');" }, { - "text": - "arr2 remains unchanged when arr1 is changed.", - "testString": - "assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length},'arr2 remains unchanged when arr1 is changed.');" + "text": "arr2 remains unchanged when arr1 is changed.", + "testString": "assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length},'arr2 remains unchanged when arr1 is changed.');" } ], "releasedOn": "Feb 17, 2017", @@ -707,24 +642,16 @@ "
const { x : a, y : b, z : c } = voxel // a = 3.6, b = 7.4, c = 6.54
", "You may read it as \"get the field x and copy the value into a,\" and so on.", "
", - "Use destructuring to obtain the length of the input string str, and assign the length to len in line." + "Use destructuring to obtain the average temperature for tomorrow from the input object AVG_TEMPERATURES, and assign value with key tomorrow to tempOfTomorrow in line." ], "tests": [ { - "text": "the function getLength() returns a number.", - "testString": - "assert(typeof getLength('') === 'number', 'the function getLength() returns a number.');" - }, - { - "text": - "getLength(\"FreeCodeCamp\") should be 12", - "testString": - "assert(getLength(\"FreeCodeCamp\") === 12, 'getLength(\"FreeCodeCamp\") should be 12');" + "text": "getTempOfTmrw(AVG_TEMPERATURES) should be 79", + "testString": "assert(getTempOfTmrw(AVG_TEMPERATURES) === 79, 'getTempOfTmrw(AVG_TEMPERATURES) should be 79');" }, { "text": "destructuring with reassignment was used", - "testString": - "getUserInput => assert(getUserInput('index').match(/\\{\\s*length\\s*:\\s*len\\s*}\\s*=\\s*str/g),'destructuring with reassignment was used');" + "testString": "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*tempOfTomorrow\\s*}\\s*=\\s*avgTemperatures/g),'destructuring with reassignment was used');" } ], "releasedOn": "Feb 17, 2017", @@ -736,18 +663,20 @@ "ext": "js", "name": "index", "contents": [ - "function getLength(str) {", - " \"use strict\";", + "const AVG_TEMPERATURES = {", + " today: 77.5,", + " tomorrow: 79", + "};", "", + "function getTempOfTmrw(avgTemperatures) {", + " \"use strict\";", " // change code below this line", - " const length = 0; // change this", + " const tempOfTomorrow = undefined; // change this line", " // change code above this line", - "", - " return len; // you must assign length to len in line", - "", + " return tempOfTomorrow;", "}", "", - "console.log(getLength('FreeCodeCamp'));" + "console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79" ], "head": [], "tail": [] @@ -756,8 +685,7 @@ }, { "id": "587d7b89367417b2b2512b4a", - "title": - "Use Destructuring Assignment to Assign Variables from Nested Objects", + "title": "Use Destructuring Assignment to Assign Variables from Nested Objects", "description": [ "We can similarly destructure nested objects into variables.", "Consider the following code:", @@ -769,13 +697,11 @@ "tests": [ { "text": "maxOfTomorrow equals 84.6", - "testString": - "assert(getMaxOfTmrw(LOCAL_FORECAST) === 84.6, 'maxOfTomorrow equals 84.6');" + "testString": "assert(getMaxOfTmrw(LOCAL_FORECAST) === 84.6, 'maxOfTomorrow equals 84.6');" }, { "text": "nested destructuring was used", - "testString": - "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*\\{\\s*max\\s*:\\s*maxOfTomorrow\\s*\\}\\s*\\}\\s*=\\s*forecast/g),'nested destructuring was used');" + "testString": "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*\\{\\s*max\\s*:\\s*maxOfTomorrow\\s*\\}\\s*\\}\\s*=\\s*forecast/g),'nested destructuring was used');" } ], "releasedOn": "Feb 17, 2017", @@ -824,18 +750,15 @@ "tests": [ { "text": "Value of a should be 6, after swapping.", - "testString": - "assert(a === 6, 'Value of a should be 6, after swapping.');" + "testString": "assert(a === 6, 'Value of a should be 6, after swapping.');" }, { "text": "Value of b should be 8, after swapping.", - "testString": - "assert(b === 8, 'Value of b should be 8, after swapping.');" + "testString": "assert(b === 8, 'Value of b should be 8, after swapping.');" }, { "text": "Use array destructuring to swap a and b.", - "testString": - "// assert(/\\[\\s*(\\w)\\s*,\\s*(\\w)\\s*\\]\\s*=\\s*\\[\\s*\\2\\s*,\\s*\\1\\s*\\]/g.test(code), 'Use array destructuring to swap a and b.');" + "testString": "// assert(/\\[\\s*(\\w)\\s*,\\s*(\\w)\\s*\\]\\s*=\\s*\\[\\s*\\2\\s*,\\s*\\1\\s*\\]/g.test(code), 'Use array destructuring to swap a and b.');" } ], "releasedOn": "Feb 17, 2017", @@ -864,8 +787,7 @@ }, { "id": "587d7b8a367417b2b2512b4c", - "title": - "Use Destructuring Assignment with the Rest Operator to Reassign Array Elements", + "title": "Use Destructuring Assignment with the Rest Operator to Reassign Array Elements", "description": [ "In some situations involving array destructuring, we might want to collect the rest of the elements into a separate array.", "The result is similar to Array.prototype.slice(), as shown below:", @@ -878,18 +800,15 @@ "tests": [ { "text": "arr should be [3,4,5,6,7,8,9,10]", - "testString": - "assert(arr.every((v, i) => v === i + 3),'arr should be [3,4,5,6,7,8,9,10]');" + "testString": "assert(arr.every((v, i) => v === i + 3),'arr should be [3,4,5,6,7,8,9,10]');" }, { "text": "destructuring was used.", - "testString": - "getUserInput => assert(getUserInput('index').match(/\\[\\s*\\w*\\s*,\\s*\\w*\\s*,\\s*...arr\\s*\\]/g),'destructuring was used.');" + "testString": "getUserInput => assert(getUserInput('index').match(/\\[\\s*\\w*\\s*,\\s*\\w*\\s*,\\s*...arr\\s*\\]/g),'destructuring was used.');" }, { "text": "Array.slice() was not used.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/Array.slice/g), 'Array.slice() was not used.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/Array.slice/g), 'Array.slice() was not used.');" } ], "releasedOn": "Feb 17, 2017", @@ -920,8 +839,7 @@ }, { "id": "587d7b8a367417b2b2512b4d", - "title": - "Use Destructuring Assignment to Pass an Object as a Function's Parameters", + "title": "Use Destructuring Assignment to Pass an Object as a Function's Parameters", "description": [ "In some cases, you can destructure the object in a function argument itself.", "Consider the code below:", @@ -936,18 +854,15 @@ "tests": [ { "text": "stats should be an object.", - "testString": - "assert(typeof stats === 'object', 'stats should be an object.');" + "testString": "assert(typeof stats === 'object', 'stats should be an object.');" }, { "text": "half(stats) should be 28.015", - "testString": - "assert(half(stats) === 28.015, 'half(stats) should be 28.015');" + "testString": "assert(half(stats) === 28.015, 'half(stats) should be 28.015');" }, { "text": "Destructuring was used.", - "testString": - "getUserInput => assert(getUserInput('index').match(/\\(\\s*\\{\\s*\\w+\\s*,\\s*\\w+\\s*\\}\\s*\\)/g), 'Destructuring was used.');" + "testString": "getUserInput => assert(getUserInput('index').match(/\\(\\s*\\{\\s*\\w+\\s*,\\s*\\w+\\s*\\}\\s*\\)/g), 'Destructuring was used.');" } ], "releasedOn": "Feb 17, 2017", @@ -1004,20 +919,16 @@ ], "tests": [ { - "text": - "resultDisplayArray is an array containing result failure messages.", - "testString": - "assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3, 'resultDisplayArray is a list containing result failure messages.');" + "text": "resultDisplayArray is an array containing result failure messages.", + "testString": "assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3, 'resultDisplayArray is a list containing result failure messages.');" }, { "text": "resultDisplayArray is the desired output.", - "testString": - "assert(makeList(result.failure).every((v, i) => v === `
  • ${result.failure[i]}
  • ` || v === `
  • ${result.failure[i]}
  • `), 'resultDisplayArray is the desired output.');" + "testString": "assert(makeList(result.failure).every((v, i) => v === `
  • ${result.failure[i]}
  • ` || v === `
  • ${result.failure[i]}
  • `), 'resultDisplayArray is the desired output.');" }, { "text": "Template strings were used", - "testString": - "getUserInput => assert(getUserInput('index').match(/`.*`/g), 'Template strings were not used');" + "testString": "getUserInput => assert(getUserInput('index').match(/`.*`/g), 'Template strings were not used');" } ], "releasedOn": "Feb 17, 2017", @@ -1072,15 +983,12 @@ ], "tests": [ { - "text": - "the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.", - "testString": - "assert(() => {const res={name:\"Zodiac Hasbro\",age:56,gender:\"male\"}; const person=createPerson(\"Zodiac Hasbro\", 56, \"male\"); return Object.keys(person).every(k => person[k] === res[k]);}, 'the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.');" + "text": "the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.", + "testString": "assert(() => {const res={name:\"Zodiac Hasbro\",age:56,gender:\"male\"}; const person=createPerson(\"Zodiac Hasbro\", 56, \"male\"); return Object.keys(person).every(k => person[k] === res[k]);}, 'the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.');" }, { "text": "No : were used.", - "testString": - "getUserInput => assert(!getUserInput('index').match(/:/g), 'No : were used.');" + "testString": "getUserInput => assert(!getUserInput('index').match(/:/g), 'No : were used.');" } ], "releasedOn": "Feb 17, 2017", @@ -1123,19 +1031,15 @@ "tests": [ { "text": "Traditional function expression was not used.", - "testString": - "assert(!getUserInput('index').match(/function/),'Traditional function expression was not used.');" + "testString": "assert(!getUserInput('index').match(/function/),'Traditional function expression was not used.');" }, { "text": "setGear is a declarative function.", - "testString": - "assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\\s*\\(.+\\)\\s*\\{/), 'setGear is a declarative function.');" + "testString": "assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\\s*\\(.+\\)\\s*\\{/), 'setGear is a declarative function.');" }, { - "text": - "bicycle.setGear(48) changes the gear value to 48.", - "testString": - "assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.');" + "text": "bicycle.setGear(48) changes the gear value to 48.", + "testString": "assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.');" } ], "releasedOn": "Feb 17, 2017", @@ -1181,25 +1085,20 @@ ], "tests": [ { - "text": - "Vegetable should be a class with a defined constructor method.", - "testString": - "assert(typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function', 'Vegetable should be a class with a defined constructor method.');" + "text": "Vegetable should be a class with a defined constructor method.", + "testString": "assert(typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function', 'Vegetable should be a class with a defined constructor method.');" }, { "text": "class keyword was used.", - "testString": - "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" + "testString": "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" }, { "text": "Vegetable can be instantiated.", - "testString": - "assert(() => {const a = new Vegetable(\"apple\"); return typeof a === 'object';},'Vegetable can be instantiated.');" + "testString": "assert(() => {const a = new Vegetable(\"apple\"); return typeof a === 'object';},'Vegetable can be instantiated.');" }, { "text": "carrot.name should return carrot.", - "testString": - "assert(carrot.name=='carrot','carrot.name should return carrot.');" + "testString": "assert(carrot.name=='carrot','carrot.name should return carrot.');" } ], "releasedOn": "Feb 17, 2017", @@ -1249,20 +1148,16 @@ ], "tests": [ { - "text": - "Thermostat should be a class with a defined constructor method.", - "testString": - "assert(typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function','Thermostat should be a class with a defined constructor method.');" + "text": "Thermostat should be a class with a defined constructor method.", + "testString": "assert(typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function','Thermostat should be a class with a defined constructor method.');" }, { "text": "class keyword was used.", - "testString": - "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" + "testString": "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" }, { "text": "Thermostat can be instantiated.", - "testString": - "assert(() => {const t = new Thermostat(32); return typeof t === 'object' && t.temperature === 0;}, 'Thermostat can be instantiated.');" + "testString": "assert(() => {const t = new Thermostat(32); return typeof t === 'object' && t.temperature === 0;}, 'Thermostat can be instantiated.');" } ], "releasedOn": "Feb 17, 2017", @@ -1312,8 +1207,7 @@ "tests": [ { "text": "valid import statement", - "testString": - "getUserInput => assert(getUserInput('index').match(/import\\s+\\{\\s*capitalizeString\\s*\\}\\s+from\\s+(\"|')string_functions\\1/g), 'valid import statement');" + "testString": "getUserInput => assert(getUserInput('index').match(/import\\s+\\{\\s*capitalizeString\\s*\\}\\s+from\\s+(\"|')string_functions\\1/g), 'valid import statement');" } ], "releasedOn": "Feb 17, 2017", @@ -1352,13 +1246,11 @@ "tests": [ { "text": "foo is exported.", - "testString": - "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+foo\\s*=\\s*\"bar\"/g), 'foo is exported.');" + "testString": "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+foo\\s*=\\s*\"bar\"/g), 'foo is exported.');" }, { "text": "bar is exported.", - "testString": - "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+bar\\s*=\\s*\"foo\"/g), 'bar is exported.');" + "testString": "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+bar\\s*=\\s*\"foo\"/g), 'bar is exported.');" } ], "releasedOn": "Feb 17, 2017", @@ -1395,8 +1287,7 @@ "tests": [ { "text": "Properly uses import * as syntax.", - "testString": - "assert(code.match(/import\\s+\\*\\s+as\\s+[a-zA-Z0-9_$]+\\s+from\\s*\"\\s*capitalize_strings\\s*\"\\s*;/gi), 'Properly uses import * as syntax.');" + "testString": "assert(code.match(/import\\s+\\*\\s+as\\s+[a-zA-Z0-9_$]+\\s+from\\s*\"\\s*capitalize_strings\\s*\"\\s*;/gi), 'Properly uses import * as syntax.');" } ], "releasedOn": "Feb 17, 2017", @@ -1435,8 +1326,7 @@ "tests": [ { "text": "Proper used of export fallback.", - "testString": - "getUserInput => assert(getUserInput('index').match(/export\\s+default\\s+function\\s+subtract\\(x,y\\)\\s+{return\\s+x\\s-\\s+y;}/g), 'Proper used of export fallback.');" + "testString": "getUserInput => assert(getUserInput('index').match(/export\\s+default\\s+function\\s+subtract\\(x,y\\)\\s+{return\\s+x\\s-\\s+y;}/g), 'Proper used of export fallback.');" } ], "releasedOn": "Feb 17, 2017", @@ -1470,8 +1360,7 @@ "tests": [ { "text": "Properly imports export default method.", - "testString": - "getUserInput => assert(getUserInput('index').match(/import\\s+subtract\\s+from\\s+\"math_functions\"/g), 'Properly imports export default method.');" + "testString": "getUserInput => assert(getUserInput('index').match(/import\\s+subtract\\s+from\\s+\"math_functions\"/g), 'Properly imports export default method.');" } ], "releasedOn": "Feb 17, 2017",