diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json
index 5193d537dc..30baf16613 100644
--- a/seed/challenges/01-front-end-development-certification/basic-javascript.json
+++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json
@@ -4167,7 +4167,7 @@
"(function(z){return z;})(myDog);"
],
"solutions": [
- "var ourDog = {\n \"name\": \"Camper\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"everything!\"],\n \"bark\": \"bow-wow\"\n};\n\nvar myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"],\n \"bark\": \"woof\"\n};\n\ndelete myDog.tails;"
+ "var ourDog = {\n \"name\": \"Camper\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"everything!\"],\n \"bark\": \"bow-wow\"\n};\nvar myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"],\n \"bark\": \"woof\"\n};\ndelete myDog.tails;"
],
"tests": [
"assert(myDog.tails === undefined, 'message: Delete the property \"tails\"
from myDog
.');",
@@ -4571,8 +4571,8 @@
"The initialization
statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.",
"The condition
statement is evaluated at the beginning of every loop iteration and will continue as long as it evalutes to true
. When condition
is false
at the start of the iteration, the loop will stop executing. This means if condition
starts as false
, your loop will never execute.",
"The final-expression
is executed at the end of each loop iteration, prior to the next condition
check and is usually used to increment or decrement your loop counter.",
- "In the following example we initialize with i = 0
and iterate while our condition i < 5
is true. We'll increment i
by 1
in each loop iteration with i++
as our final-expression
.",
- "
var ourArray = [];", + "In the following example we initialize with
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
i = 0
and iterate while our condition i < 5
is true. We'll increment i
by 1
in each loop iteration with i++
as our final-expression
.",
+ "var ourArray = [];", "
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
ourArray
will now contain [0,1,2,3,4]
.",
"for
loop to work to push the values 1 through 5 onto myArray
."
@@ -4628,8 +4628,8 @@
"title": "Iterate Odd Numbers With a For Loop",
"description": [
"For loops don't have to iterate one at a time. By changing our final-expression
, we can count by even numbers.",
- "We'll start at i = 0
and loop while i < 10
. We'll increment i
by 2 each loop with i += 2
.",
- "var ourArray = [];", + "We'll start at
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
i = 0
and loop while i < 10
. We'll increment i
by 2 each loop with i += 2
.",
+ "var ourArray = [];", "
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
ourArray
will now contain [0,2,4,6,8]
.",
"Let's change our initialization
so we can count by odd numbers.",
"initialization
, condition
, and final-expression
.",
- "We'll start at i = 10
and loop while i > 0
. We'll decrement i
by 2 each loop with i -= 2
.",
- "var ourArray = [];", + "We'll start at
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
i = 10
and loop while i > 0
. We'll decrement i
by 2 each loop with i -= 2
.",
+ "var ourArray = [];", "
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
ourArray
will now contain [10,8,6,4,2]
.",
"Let's change our initialization
and final-expression
so we can count backward by twos by odd numbers.",
"while loop
\", because it runs \"while\" a specified condition is true and stops once that condition is no longer true.",
- "var ourArray = [];", + "
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
var ourArray = [];", "Let's try getting a while loop to work by pushing values to an array.", "
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
myArray
using a while
loop."
@@ -5016,7 +5016,7 @@
"(function(){return randomWholeNum();})();"
],
"solutions": [
- "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);\n\nfunction randomWholeNum() {\n return Math.floor(Math.random() * 10);\n}"
+ "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);\nfunction randomWholeNum() {\n return Math.floor(Math.random() * 10);\n}"
],
"tests": [
"assert(typeof randomWholeNum() === \"number\" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})(), 'message: The result of randomWholeNum
should be a whole number.');",
@@ -5152,7 +5152,7 @@
"(function(){return andCount;})();"
],
"solutions": [
- "var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";\nvar expression = /and/gi; // Change this Line\nvar andCount = testString.match(expression).length;"
+ "var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";\nvar expression = /and/gi;\nvar andCount = testString.match(expression).length;"
],
"tests": [
"assert(andCount==2, 'message: Your regular expression
should find two occurrences of the word and
.');",
@@ -5206,7 +5206,7 @@
"(function(){return digitCount;})();"
],
"solutions": [
- "var testString = \"There are 3 cats but 4 dogs.\";\nvar expression = /\\d+/g; // Change this line\nvar digitCount = testString.match(expression).length;"
+ "var testString = \"There are 3 cats but 4 dogs.\";\nvar expression = /\\d+/g;\nvar digitCount = testString.match(expression).length;"
],
"tests": [
"assert(digitCount === 2, 'message: Your regular expression should find two numbers in testString
.');",
@@ -5255,7 +5255,7 @@
"(function(){return spaceCount;})();"
],
"solutions": [
- "var testString = \"How many spaces are there in this sentence?\";\nvar expression = /\\s+/g; // Change this line\nvar spaceCount = testString.match(expression).length;"
+ "var testString = \"How many spaces are there in this sentence?\";\nvar expression = /\\s+/g;\nvar spaceCount = testString.match(expression).length;"
],
"tests": [
"assert(spaceCount === 7, 'message: Your regular expression should find seven spaces in testString
.');",
diff --git a/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json b/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json
index a9914c5593..44a75ff99f 100644
--- a/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json
+++ b/seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json
@@ -321,6 +321,9 @@
"tail": [
"(function() {return newArray;})();"
],
+ "solutions": [
+ "var oldArray = [1,2,3,4,5];\nvar newArray = oldArray.map(function(val){\n return val + 3;\n});"
+ ],
"tests": [
"assert.deepEqual(oldArray, [1,2,3,4,5], 'message: You should not change the original array.');",
"assert.deepEqual(newArray, [4,5,6,7,8], 'message: You should add three to each value in the array.');",
@@ -363,6 +366,9 @@
"tail": [
"(function() {return singleVal;})();"
],
+ "solutions": [
+ "var array = [4,5,6,7,8];\nvar singleVal = 0;\nsingleVal = array.reduce(function(previousVal, currentVal) {\n return previousVal + currentVal;\n}, 0);"
+ ],
"tests": [
"assert(singleVal == 30, 'message: singleVal
should be equal to the sum of all items in the array
variable.');",
"assert(editor.getValue().match(/\\.reduce\\s*\\(/gi), 'message: You should have made use of the reduce
method.');"
@@ -403,6 +409,9 @@
"tail": [
"(function() {return newArray;})();"
],
+ "solutions": [
+ "var oldArray = [1,2,3,4,5,6,7,8,9,10];\nvar newArray = oldArray.filter(function(val) {\n return val < 6;\n});"
+ ],
"tests": [
"assert.deepEqual(oldArray, [1,2,3,4,5,6,7,8,9,10], 'message: You should not change the original array.');",
"assert.deepEqual(newArray, [1,2,3,4,5], 'message: You should have filtered out all values from the array that are greater than 5.');",
@@ -446,6 +455,9 @@
"tail": [
"(function() {return array;})();"
],
+ "solutions": [
+ "var array = [1, 12, 21, 2];\narray.sort(function(a, b) {\n return b - a;\n});"
+ ],
"tests": [
"assert.deepEqual(array, [21, 12, 2, 1], 'message: You should have sorted the array from largest to smallest.');",
"assert(editor.getValue().match(/\\[1,\\s*12,\\s*21,\\s*2\\];/gi), 'message: You should only be using sort
to modify the array.');",
@@ -487,6 +499,9 @@
"tail": [
"(function() {return newArray;})();"
],
+ "solutions": [
+ "var array = [1,2,3,4,5,6,7];\nvar newArray = [];\nnewArray = array.reverse();"
+ ],
"tests": [
"assert.deepEqual(newArray, [7,6,5,4,3,2,1], 'message: You should reverse the array.');",
"assert(editor.getValue().match(/\\.reverse\\s*\\(\\)/gi), 'message: You should use the reverse
method.');",
@@ -527,6 +542,9 @@
"tail": [
"(function() {return newArray;})();"
],
+ "solutions": [
+ "var oldArray = [1,2,3];\nvar newArray = [];\nvar concatMe = [4,5,6];\nnewArray = oldArray.concat(concatMe);"
+ ],
"tests": [
"assert.deepEqual(newArray, [1,2,3,4,5,6], 'message: You should concatenate the two arrays together.');",
"assert(editor.getValue().match(/\\.concat\\s*\\(/gi), 'message: You should be using the concat
method to merge the two arrays.');",
@@ -564,6 +582,9 @@
"tail": [
"(function() {return array;})();"
],
+ "solutions": [
+ "var string = \"Split me into an array\";\nvar array = [];\narray = string.split(\" \");"
+ ],
"tests": [
"assert(/\\.split\\(/gi, 'message: You should use the split
method on the string.');",
"assert(typeof array === 'object' && array.length === 5, 'message: You should split the string by its spaces.');"
@@ -599,6 +620,9 @@
"tail": [
"(function() {return joinedString;})();"
],
+ "solutions": [
+ "var joinMe = [\"Split\",\"me\",\"into\",\"an\",\"array\"];\nvar joinedString = '';\njoinedString = joinMe.join(\" \");"
+ ],
"tests": [
"assert(typeof joinedString === 'string' && joinedString === \"Split me into an array\", 'message: You should join the elements of the array with spaces.');",
"assert(/\\.join\\(/gi, 'message: You should use of the join
method on the array.');"
diff --git a/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json b/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json
index fab459adc4..b339ed1b1a 100644
--- a/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json
+++ b/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json
@@ -18,6 +18,9 @@
"",
""
],
+ "solutions": [
+ "console.log('Hello world!');"
+ ],
"tests": [
"assert(editor.getValue().match(/console\\.log\\(/gi), 'message: You should use the console.log method to log \"Hello world!\" to your JavaScript console.');"
],
@@ -48,6 +51,9 @@
"",
""
],
+ "solutions": [
+ "console.log(typeof \"\");\nconsole.log(typeof 0);\nconsole.log(typeof []);\nconsole.log(typeof {});"
+ ],
"tests": [
"assert(code.match(/console\\.log\\(typeof[\\( ][\"'].*[\"']\\)?\\);/), 'message: You should console.log
the typeof
a string.');",
"assert(code.match(/console\\.log\\(typeof[\\( ]\\d+\\.?\\d*\\)?\\);/), 'message: You should console.log
the typeof
a number.');",