diff --git a/common/models/user.json b/common/models/user.json
index f696b49102..3bdfb8be7d 100644
--- a/common/models/user.json
+++ b/common/models/user.json
@@ -92,12 +92,6 @@
"twitter": {
"type": "string"
},
- "facebook": {
- "type": "string"
- },
- "google": {
- "type": "string"
- },
"currentStreak": {
"type": "number",
"default": 0
diff --git a/seed/challenges/00-getting-started/getting-started.json b/seed/challenges/00-getting-started/getting-started.json
index a9221ffe00..1946577f6f 100644
--- a/seed/challenges/00-getting-started/getting-started.json
+++ b/seed/challenges/00-getting-started/getting-started.json
@@ -660,7 +660,7 @@
[
"//i.imgur.com/fTFMjwf.gif",
"A gif showing how you can click the link below, find your city on the list of Campsites, then click on the Facebook link for your city and join your city's Facebook group.",
- "Find your city on this list and click it. This will take you to your city's Campsite's Facebook group. Click the \"Join group\" button to apply to join your city's Facebook group. Someone from the campsite should approve you shortly. If your city isn't on this list, scroll to the bottom of the wiki article for instructions for how you can create your city's Campsite.",
+ "Find your city on this list and click it. This will take you to your city's Campsite's Facebook group. Click the \"Join group\" button to apply to join your city's Facebook group. Someone from the campsite should approve you shortly. If your city isn't on this list, scroll to the top of the wiki article for instructions for how you can create your city's Campsite.",
"https://github.com/FreeCodeCamp/freecodecamp/wiki/List-of-Free-Code-Camp-city-based-Campsites"
]
],
@@ -748,7 +748,7 @@
[
"//i.imgur.com/ZRgXraT.gif",
"A gif showing us scrolling through our challenge map.",
- "Now you're ready to start coding. The \"Map\" button in your upper right hand corner will show you our challenge map. We recommend that you complete these from top to bottom, at a sustainable pace. Our open source community is constantly improving our challenges, so don't be surprised if they change or move around. Don't worry about going back - just keep moving forward. You can always go to your most recent challenge by clicking the \"Learn\" button.",
+ "Now you're ready to start coding. The \"Map\" button in your upper right hand corner will show you our challenge map. We recommend that you complete these from top to bottom, at a sustainable pace. Our open source community is constantly improving our challenges, so don't be surprised if they change or move around. Don't worry about going back - just keep moving forward.",
""
]
],
diff --git a/seed/challenges/01-front-end-development-certification/advanced-bonfires.json b/seed/challenges/01-front-end-development-certification/advanced-bonfires.json
index 5ce1ff1abc..42b752a3d5 100644
--- a/seed/challenges/01-front-end-development-certification/advanced-bonfires.json
+++ b/seed/challenges/01-front-end-development-certification/advanced-bonfires.json
@@ -405,9 +405,12 @@
"id": "a3f503de51cfab748ff001aa",
"title": "Pairwise",
"description": [
- "Return the sum of all element indices of array arr
that can be paired with one other element to form a sum that equals the value in the second argument arg
. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.",
- "For example, pairwise([1, 4, 2, 3, 0, 5], 7)
should return 11
because 4, 2, 3 and 5 can be paired with each other to equal 7 and their indices (1, 2, 3, and 5) sum to 11.",
- "pairwise([1, 3, 2, 4], 4)
would only return 1
, because only the first two elements can be paired to equal 4, and the first element has an index of 0!",
+ "Given an array arr
, find element pairs whose sum equal the second argument arg
and return the sum of their indices.",
+ "If multiple pairs are possible that have the same numeric elements but different indices, return the smallest sum of indices. Once an element has been used, it cannot be reused to pair with another.",
+ "For example pairwise([7, 9, 11, 13, 15], 20)
returns 6
. The pairs that sum to 20 are [7, 13]
and [9, 11]
. We can then write out the array with their indices and values.",
+ "
Index | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
Value | 7 | 9 | 11 | 13 | 15 |
6
",
"Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code."
],
"challengeSeed": [
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 e10ae3470f..5193d537dc 100644
--- a/seed/challenges/01-front-end-development-certification/basic-javascript.json
+++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json
@@ -861,7 +861,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function convert(celsius) {",
+ "function convertToF(celsius) {",
" // Only change code below this line",
" ",
" ",
@@ -870,18 +870,18 @@
"}",
"",
"// Change the inputs below to test your code",
- "convert(30);"
+ "convertToF(30);"
],
"solutions": [
- "function convert(celsius) {\n var fahrenheit = celsius * 9/5 + 32;\n if ( typeof fahrenheit !== 'undefined' ) {\n return fahrenheit;\n } else {\n return 'fahrenheit not defined';\n }\n}"
+ "function convertToF(celsius) {\n var fahrenheit = celsius * 9/5 + 32;\n if ( typeof fahrenheit !== 'undefined' ) {\n return fahrenheit;\n } else {\n return 'fahrenheit not defined';\n }\n}"
],
"tests": [
- "assert(typeof convert(0) === 'number', 'message: convert(0)
should return a number');",
- "assert(convert(-30) === -22, 'message: convert(-30)
should return a value of -22
');",
- "assert(convert(-10) === 14, 'message: convert(-10)
should return a value of 14
');",
- "assert(convert(0) === 32, 'message: convert(0)
should return a value of 32
');",
- "assert(convert(20) === 68, 'message: convert(20)
should return a value of 68
');",
- "assert(convert(30) === 86, 'message: convert(30)
should return a value of 86
');"
+ "assert(typeof convertToF(0) === 'number', 'message: convertToF(0)
should return a number');",
+ "assert(convertToF(-30) === -22, 'message: convertToF(-30)
should return a value of -22
');",
+ "assert(convertToF(-10) === 14, 'message: convertToF(-10)
should return a value of 14
');",
+ "assert(convertToF(0) === 32, 'message: convertToF(0)
should return a value of 32
');",
+ "assert(convertToF(20) === 68, 'message: convertToF(20)
should return a value of 68
');",
+ "assert(convertToF(30) === 86, 'message: convertToF(30)
should return a value of 86
');"
],
"type": "checkpoint",
"challengeType": 1,
@@ -2027,15 +2027,15 @@
"functionName();
",
"Each time the function is called it will print out the message \"Hello World\"
on the dev console. All of the code between the curly braces will be executed every time the function is called.",
"myFunction
which prints \"Hi World\"
to the dev console.reusableFunction
which prints \"Hi World\"
to the dev console.myFunction
should be a function');",
- "assert(\"Hi World\" === logOutput, 'message: myFunction
should output \"Hi World\" to the dev console');",
- "assert(/^\\s*myFunction\\(\\)\\s*;/m.test(code), 'message: Call myFunction
after you define it');"
+ "assert(typeof reusableFunction === 'function', 'message: reusableFunction
should be a function');",
+ "assert(\"Hi World\" === logOutput, 'message: reusableFunction
should output \"Hi World\" to the dev console');",
+ "assert(/^\\s*reusableFunction\\(\\)\\s*;/m.test(code), 'message: Call reusableFunction
after you define it');"
],
"type": "waypoint",
"challengeType": 1,
@@ -2104,7 +2104,7 @@
"testFun(\"Hello\", \"World\");
",
"We have passed two arguments, \"Hello\"
and \"World\"
. Inside the function, param1
will equal \"Hello\" and param2
will equal \"World\". Note that you could call testFun
again with different arguments and the parameters would take on the value of the new arguments.",
"myFunction
that accepts two arguments and outputs their sum to the dev console.functionWithArgs
that accepts two arguments and outputs their sum to the dev console.myFunction
should be a function');",
- "if(typeof myFunction === \"function\") { capture(); myFunction(1,2); uncapture(); } assert(logOutput == 3, 'message: myFunction(1,2)
should output 3
');",
- "if(typeof myFunction === \"function\") { capture(); myFunction(7,9); uncapture(); } assert(logOutput == 16, 'message: myFunction(7,9)
should output 16
');",
- "assert(/^\\s*myFunction\\s*\\([\\w\\W]+\\)\\s*;/m.test(code), 'message: Call myFunction
after you define it.');"
+ "assert(typeof functionWithArgs === 'function', 'message: functionWithArgs
should be a function');",
+ "if(typeof functionWithArgs === \"function\") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3, 'message: functionWithArgs(1,2)
should output 3
');",
+ "if(typeof functionWithArgs === \"function\") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16, 'message: functionWithArgs(7,9)
should output 16
');",
+ "assert(/^\\s*functionWithArgs\\s*\\([\\w\\W]+\\)\\s*;/m.test(code), 'message: Call functionWithArgs
after you define it.');"
],
"type": "waypoint",
"challengeType": 1,
@@ -2169,7 +2169,7 @@
"testFun(\"Hello\", \"World\");
",
"Nosotros hemos pasado dos argumentos, \"Hello\"
y \"World\"
. Dentro de la función, param1
será igual a \"Hello\" y param2
será igual a \"World\". Nota que puedes llamar testFun
otra vez con argumentos diferentes y los parámetros asumirían el valor de los nuevos argumentos.",
"myFunction
que acepte dos argumentos y da salida a su suma en la consola.functionWithArgs
que acepte dos argumentos y da salida a su suma en la consola.function myTest() {", "
var loc = \"foo\";
console.log(loc);
}
myTest(); // \"foo\"
console.log(loc); // \"undefined\"
loc
is not defined outside of the function.",
"myVar
inside myFunction
. Run the tests and then follow the instructions commented out in the editor.",
+ "Declare a local variable myVar
inside myLocalScope
. Run the tests and then follow the instructions commented out in the editor.",
"HintmyVar
variable');",
@@ -2323,7 +2323,7 @@
"function myTest() {", "
var loc = \"foo\";
console.log(loc);
}
myTest(); // \"foo\"
console.log(loc); // \"undefined\"
loc
no está definida fuera de la función.",
"myVar
dentro de myFunction
"
+ "Declara una variable local myVar
dentro de myLocalScope
"
]
},
{
@@ -2335,14 +2335,14 @@
"var someVar = \"Hat\";", "The function
function myFun() {
var someVar = \"Head\";
return someVar;
}
myFun
will return \"Head\"
because the local
version of the variable is present.",
"myFunction
to override the value of outerWear
with \"sweater\"
."
+ "Add a local variable to myOutfit
to override the value of outerWear
with \"sweater\"
."
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
"// Setup",
"var outerWear = \"T-Shirt\";",
"",
- "function myFunction() {",
+ "function myOutfit() {",
" // Only change code below this line",
" ",
" ",
@@ -2351,14 +2351,14 @@
" return outerWear;",
"}",
"",
- "myFunction();"
+ "myOutfit();"
],
"solutions": [
- "var outerWear = \"T-Shirt\";\nfunction myFunction() {\n var outerWear = \"sweater\";\n return outerWear;\n}"
+ "var outerWear = \"T-Shirt\";\nfunction myOutfit() {\n var outerWear = \"sweater\";\n return outerWear;\n}"
],
"tests": [
"assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear
');",
- "assert(myFunction() === \"sweater\", 'message: myFunction
should return \"sweater\"
');",
+ "assert(myOutfit() === \"sweater\", 'message: myOutfit
should return \"sweater\"
');",
"assert(/return outerWear/.test(code), 'message: Do not change the return statement');"
],
"type": "waypoint",
@@ -2370,7 +2370,7 @@
"var algunaVar = \"Sombrero\";", "La función
function miFun() {
var algunaVar = \"Cabeza\";
return algunaVar;
}
miFun
regresará \"Cabeza\"
porque la versión local
de la variable tiene precedencia.",
"myFunction
para sobreescribir el valor de outerWear
con \"sweater\"
."
+ "Agrega una variable local a myOutfit
para sobreescribir el valor de outerWear
con \"sweater\"
."
]
},
{
@@ -2423,12 +2423,12 @@
"id": "56533eb9ac21ba0edf2244c3",
"title": "Assignment with a Returned Value",
"description": [
- "If you'll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.",
+ "If you'll recall from our discussion of Storing Values with the Assignment Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.",
"Assume we have pre-defined a function sum
which adds two numbers together, then: ",
"ourSum = sum(5, 12);
",
"will call sum
function, which returns a value of 17
and assigns it to ourSum
variable.",
"process
function with an argument of 7
and assign its return value to the variable processed
."
+ "Call the processArg
function with an argument of 7
and assign its return value to the variable processed
."
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
@@ -2444,7 +2444,7 @@
"// Setup",
"var processed = 0;",
"",
- "function process(num) {",
+ "function processArg(num) {",
" return (num + 3) / 5;",
"}",
"",
@@ -2456,11 +2456,11 @@
"(function(){return \"processed = \" + processed})();"
],
"solutions": [
- "var processed = 0;\n\nfunction process(num) {\n return (num + 3) / 5;\n}\n\nprocessed = process(7);"
+ "var processed = 0;\n\nfunction processArg(num) {\n return (num + 3) / 5;\n}\n\nprocessed = processArg(7);"
],
"tests": [
"assert(processed === 2, 'message: processed
should have a value of 2
');",
- "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(code), 'message: You should assign process
to processed
');"
+ "assert(/processed\\s*=\\s*processArg\\(\\s*7\\s*\\)\\s*;/.test(code), 'message: You should assign processArg
to processed
');"
],
"type": "waypoint",
"challengeType": 1,
@@ -2471,7 +2471,7 @@
"nuestraSuma = suma(5, 12);
",
"llamará la función suma
, la cual retornará un valor de 17
y lo asignará a la variable nuestraSuma
.",
"process
con un argumento 7
y asigna su valor de retorno a la variable processed
."
+ "Llama la función processArg
con un argumento 7
y asigna su valor de retorno a la variable processed
."
]
},
{
@@ -2479,7 +2479,7 @@
"title": "Stand in Line",
"description": [
"In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue
and old items are taken off from the front of the queue
.",
- "Write a function queue
which takes an array (arr
) and a number (item
) as arguments. Add the number to the end of the array, then remove the first element of array. The queue function should then return the element that was removed."
+ "Write a function nextInLine
which takes an array (arr
) and a number (item
) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed."
],
"releasedOn": "January 1, 2016",
"head": [
@@ -2505,7 +2505,7 @@
"capture();"
],
"challengeSeed": [
- "function queue(arr, item) {",
+ "function nextInLine(arr, item) {",
" // Your code here",
" ",
" return item; // Change this line",
@@ -2516,7 +2516,7 @@
"",
"// Display Code",
"console.log(\"Before: \" + JSON.stringify(testArr));",
- "console.log(queue(testArr, 6)); // Modify this line to test",
+ "console.log(nextInLine(testArr, 6)); // Modify this line to test",
"console.log(\"After: \" + JSON.stringify(testArr));"
],
"tail": [
@@ -2525,20 +2525,20 @@
"(function() { return logOutput.join(\"\\n\");})();"
],
"solutions": [
- "var testArr = [ 1,2,3,4,5];\n\nfunction queue(arr, item) {\n arr.push(item);\n return arr.shift();\n}"
+ "var testArr = [ 1,2,3,4,5];\n\nfunction nextInLine(arr, item) {\n arr.push(item);\n return arr.shift();\n}"
],
"tests": [
- "assert(queue([],1) === 1, 'message: queue([], 1)
should return 1
');",
- "assert(queue([2],1) === 2, 'message: queue([2], 1)
should return 2
');",
- "assert(queue([5,6,7,8,9],1) === 5, 'message: queue([5,6,7,8,9], 1)
should return 5
');",
- "queue(testArr, 10); assert(testArr[4] === 10, 'message: After queue(testArr, 10)
, testArr[4]
should be 10
');"
+ "assert(nextInLine([],1) === 1, 'message: nextInLine([], 1)
should return 1
');",
+ "assert(nextInLine([2],1) === 2, 'message: nextInLine([2], 1)
should return 2
');",
+ "assert(nextInLine([5,6,7,8,9],1) === 5, 'message: nextInLine([5,6,7,8,9], 1)
should return 5
');",
+ "nextInLine(testArr, 10); assert(testArr[4] === 10, 'message: After nextInLine(testArr, 10)
, testArr[4]
should be 10
');"
],
"type": "checkpoint",
"challengeType": 1,
"titleEs": "Hacer cola",
"descriptionEs": [
"En Ciencias de la Computación una cola es una Estructura de Datos abstracta donde los elementos son mantenidos en orden. Nuevos elementos pueden ser agregados en la parte trasera de la cola
y los elementos viejos son quitados desde el frente de la cola
.",
- "Escribe una función queue
la cual toma un vector (arr
) y un número (item
) como argumentos. Agrega el número al final del vector, entonces retira el primer elemento del vector. La función queue debe entonces devolver el elemento que se ha eliminado."
+ "Escribe una función nextInLine
la cual toma un vector (arr
) y un número (item
) como argumentos. Agrega el número al final del vector, entonces retira el primer elemento del vector. La función nextInLine debe entonces devolver el elemento que se ha eliminado."
]
},
{
@@ -2604,7 +2604,7 @@
"}",
"",
"// Setup",
- "function myFunction(wasThatTrue) {",
+ "function trueOrFalse(wasThatTrue) {",
"",
" // Only change code below this line.",
" ",
@@ -2615,17 +2615,17 @@
"}",
"",
"// Change this value to test",
- "myFunction(true);"
+ "trueOrFalse(true);"
],
"solutions": [
- "function myFunction(wasThatTrue) {\n if (wasThatTrue) {\n return \"That was true\";\n }\n return \"That was false\";\n}"
+ "function trueOrFalse(wasThatTrue) {\n if (wasThatTrue) {\n return \"That was true\";\n }\n return \"That was false\";\n}"
],
"tests": [
- "assert(typeof myFunction === \"function\", 'message: myFunction
should be a function');",
- "assert(typeof myFunction(true) === \"string\", 'message: myFunction(true)
should return a string');",
- "assert(typeof myFunction(false) === \"string\", 'message: myFunction(false)
should return a string');",
- "assert(myFunction(true) === \"That was true\", 'message: myFunction(true)
should return \"That was true\"');",
- "assert(myFunction(false) === \"That was false\", 'message: myFunction(false)
should return \"That was false\"');"
+ "assert(typeof trueOrFalse === \"function\", 'message: trueOrFalse
should be a function');",
+ "assert(typeof trueOrFalse(true) === \"string\", 'message: trueOrFalse(true)
should return a string');",
+ "assert(typeof trueOrFalse(false) === \"string\", 'message: trueOrFalse(false)
should return a string');",
+ "assert(trueOrFalse(true) === \"That was true\", 'message: trueOrFalse(true)
should return \"That was true\"');",
+ "assert(trueOrFalse(false) === \"That was false\", 'message: trueOrFalse(false)
should return \"That was false\"');"
],
"type": "waypoint",
"challengeType": 1,
@@ -2660,7 +2660,7 @@
"releasedOn": "January 1, 2016",
"challengeSeed": [
"// Setup",
- "function myTest(val) {",
+ "function testEqual(val) {",
" if (val) { // Change this line",
" return \"Equal\";",
" }",
@@ -2668,15 +2668,15 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testEqual(10);"
],
"solutions": [
- "function myTest(val) {\n if (val == 12) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}"
+ "function testEqual(val) {\n if (val == 12) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}"
],
"tests": [
- "assert(myTest(10) === \"Not Equal\", 'message: myTest(10)
should return \"Not Equal\"');",
- "assert(myTest(12) === \"Equal\", 'message: myTest(12)
should return \"Equal\"');",
- "assert(myTest(\"12\") === \"Equal\", 'message: myTest(\"12\")
should return \"Equal\"');",
+ "assert(testEqual(10) === \"Not Equal\", 'message: testEqual(10)
should return \"Not Equal\"');",
+ "assert(testEqual(12) === \"Equal\", 'message: testEqual(12)
should return \"Equal\"');",
+ "assert(testEqual(\"12\") === \"Equal\", 'message: testEqual(\"12\")
should return \"Equal\"');",
"assert(code.match(/val\\s*==[\\s'\"\\d]+/g).length > 0, 'message: You should use the ==
operator');"
],
"type": "waypoint",
@@ -2707,7 +2707,7 @@
"releasedOn": "January 1, 2016",
"challengeSeed": [
"// Setup",
- "function myTest(val) {",
+ "function testStrict(val) {",
" if (val) { // Change this line",
" return \"Equal\";",
" }",
@@ -2715,15 +2715,15 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testStrict(10);"
],
"solutions": [
- "function myTest(val) {\n if (val === 7) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}"
+ "function testStrict(val) {\n if (val === 7) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}"
],
"tests": [
- "assert(myTest(10) === \"Not Equal\", 'message: myTest(10)
should return \"Not Equal\"');",
- "assert(myTest(7) === \"Equal\", 'message: myTest(7)
should return \"Equal\"');",
- "assert(myTest(\"7\") === \"Not Equal\", 'message: myTest(\"7\")
should return \"Not Equal\"');",
+ "assert(testStrict(10) === \"Not Equal\", 'message: testStrict(10)
should return \"Not Equal\"');",
+ "assert(testStrict(7) === \"Equal\", 'message: testStrict(7)
should return \"Equal\"');",
+ "assert(testStrict(\"7\") === \"Not Equal\", 'message: testStrict(\"7\")
should return \"Not Equal\"');",
"assert(code.match(/val\\s*===\\s*\\d+/g).length > 0, 'message: You should use the ===
operator');"
],
"type": "waypoint",
@@ -2751,7 +2751,7 @@
"releasedOn": "January 1, 2016",
"challengeSeed": [
"// Setup",
- "function myTest(val) {",
+ "function testNotEqual(val) {",
" if (val) { // Change this line",
" return \"Not Equal\";",
" }",
@@ -2759,17 +2759,17 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testNotEqual(10);"
],
"solutions": [
- "function myTest(val) {\n if (val != 99) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}"
+ "function testNotEqual(val) {\n if (val != 99) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}"
],
"tests": [
- "assert(myTest(99) === \"Equal\", 'message: myTest(99)
should return \"Equal\"');",
- "assert(myTest(\"99\") === \"Equal\", 'message: myTest(\"99\")
should return \"Equal\"');",
- "assert(myTest(12) === \"Not Equal\", 'message: myTest(12)
should return \"Not Equal\"');",
- "assert(myTest(\"12\") === \"Not Equal\", 'message: myTest(\"12\")
should return \"Not Equal\"');",
- "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\")
should return \"Not Equal\"');",
+ "assert(testNotEqual(99) === \"Equal\", 'message: testNotEqual(99)
should return \"Equal\"');",
+ "assert(testNotEqual(\"99\") === \"Equal\", 'message: testNotEqual(\"99\")
should return \"Equal\"');",
+ "assert(testNotEqual(12) === \"Not Equal\", 'message: testNotEqual(12)
should return \"Not Equal\"');",
+ "assert(testNotEqual(\"12\") === \"Not Equal\", 'message: testNotEqual(\"12\")
should return \"Not Equal\"');",
+ "assert(testNotEqual(\"bob\") === \"Not Equal\", 'message: testNotEqual(\"bob\")
should return \"Not Equal\"');",
"assert(code.match(/val\\s*!=\\s*\\d+/g).length > 0, 'message: You should use the !=
operator');"
],
"type": "waypoint",
@@ -2796,7 +2796,7 @@
"releasedOn": "January 1, 2016",
"challengeSeed": [
"// Setup",
- "function myTest(val) {",
+ "function testStrictNotEqual(val) {",
" // Only Change Code Below this Line",
" ",
" if (val) {",
@@ -2809,16 +2809,16 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testStrictNotEqual(10);"
],
"solutions": [
- "function myTest(val) {\n if (val !== 17) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}"
+ "function testStrictNotEqual(val) {\n if (val !== 17) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}"
],
"tests": [
- "assert(myTest(17) === \"Equal\", 'message: myTest(17)
should return \"Equal\"');",
- "assert(myTest(\"17\") === \"Not Equal\", 'message: myTest(\"17\")
should return \"Not Equal\"');",
- "assert(myTest(12) === \"Not Equal\", 'message: myTest(12)
should return \"Not Equal\"');",
- "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\")
should return \"Not Equal\"');",
+ "assert(testStrictNotEqual(17) === \"Equal\", 'message: testStrictNotEqual(17)
should return \"Equal\"');",
+ "assert(testStrictNotEqual(\"17\") === \"Not Equal\", 'message: testStrictNotEqual(\"17\")
should return \"Not Equal\"');",
+ "assert(testStrictNotEqual(12) === \"Not Equal\", 'message: testStrictNotEqual(12)
should return \"Not Equal\"');",
+ "assert(testStrictNotEqual(\"bob\") === \"Not Equal\", 'message: testStrictNotEqual(\"bob\")
should return \"Not Equal\"');",
"assert(code.match(/val\\s*!==\\s*\\d+/g).length > 0, 'message: You should use the !==
operator');"
],
"type": "waypoint",
@@ -2845,7 +2845,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testGreaterThan(val) {",
" if (val) { // Change this line",
" return \"Over 100\";",
" }",
@@ -2858,19 +2858,19 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testGreaterThan(10);"
],
"solutions": [
- "function myTest(val) {\n if (val > 100) { // Change this line\n return \"Over 100\";\n }\n if (val > 10) { // Change this line\n return \"Over 10\";\n }\n return \"10 or Under\";\n}"
+ "function testGreaterThan(val) {\n if (val > 100) { // Change this line\n return \"Over 100\";\n }\n if (val > 10) { // Change this line\n return \"Over 10\";\n }\n return \"10 or Under\";\n}"
],
"tests": [
- "assert(myTest(0) === \"10 or Under\", 'message: myTest(0)
should return \"10 or Under\"');",
- "assert(myTest(10) === \"10 or Under\", 'message: myTest(10)
should return \"10 or Under\"');",
- "assert(myTest(11) === \"Over 10\", 'message: myTest(11)
should return \"Over 10\"');",
- "assert(myTest(99) === \"Over 10\", 'message: myTest(99)
should return \"Over 10\"');",
- "assert(myTest(100) === \"Over 10\", 'message: myTest(100)
should return \"Over 10\"');",
- "assert(myTest(101) === \"Over 100\", 'message: myTest(101)
should return \"Over 100\"');",
- "assert(myTest(150) === \"Over 100\", 'message: myTest(150)
should return \"Over 100\"');",
+ "assert(testGreaterThan(0) === \"10 or Under\", 'message: testGreaterThan(0)
should return \"10 or Under\"');",
+ "assert(testGreaterThan(10) === \"10 or Under\", 'message: testGreaterThan(10)
should return \"10 or Under\"');",
+ "assert(testGreaterThan(11) === \"Over 10\", 'message: testGreaterThan(11)
should return \"Over 10\"');",
+ "assert(testGreaterThan(99) === \"Over 10\", 'message: testGreaterThan(99)
should return \"Over 10\"');",
+ "assert(testGreaterThan(100) === \"Over 10\", 'message: testGreaterThan(100)
should return \"Over 10\"');",
+ "assert(testGreaterThan(101) === \"Over 100\", 'message: testGreaterThan(101)
should return \"Over 100\"');",
+ "assert(testGreaterThan(150) === \"Over 100\", 'message: testGreaterThan(150)
should return \"Over 100\"');",
"assert(code.match(/val\\s*>\\s*('|\")*\\d+('|\")*/g).length > 1, 'message: You should use the >
operator at least twice');"
],
"type": "waypoint",
@@ -2898,7 +2898,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testGreaterOrEqual(val) {",
" if (val) { // Change this line",
" return \"20 or Over\";",
" }",
@@ -2911,19 +2911,19 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testGreaterOrEqual(10);"
],
"solutions": [
- "function myTest(val) {\n if (val >= 20) { // Change this line\n return \"20 or Over\";\n }\n \n if (val >= 10) { // Change this line\n return \"10 or Over\";\n }\n\n return \"9 or Under\";\n}"
+ "function testGreaterOrEqual(val) {\n if (val >= 20) { // Change this line\n return \"20 or Over\";\n }\n \n if (val >= 10) { // Change this line\n return \"10 or Over\";\n }\n\n return \"9 or Under\";\n}"
],
"tests": [
- "assert(myTest(0) === \"9 or Under\", 'message: myTest(0)
should return \"9 or Under\"');",
- "assert(myTest(9) === \"9 or Under\", 'message: myTest(9)
should return \"9 or Under\"');",
- "assert(myTest(10) === \"10 or Over\", 'message: myTest(10)
should return \"10 or Over\"');",
- "assert(myTest(11) === \"10 or Over\", 'message: myTest(11)
should return \"10 or Over\"');",
- "assert(myTest(19) === \"10 or Over\", 'message: myTest(19)
should return \"10 or Over\"');",
- "assert(myTest(100) === \"20 or Over\", 'message: myTest(100)
should return \"20 or Over\"');",
- "assert(myTest(21) === \"20 or Over\", 'message: myTest(21)
should return \"20 or Over\"');",
+ "assert(testGreaterOrEqual(0) === \"9 or Under\", 'message: testGreaterOrEqual(0)
should return \"9 or Under\"');",
+ "assert(testGreaterOrEqual(9) === \"9 or Under\", 'message: testGreaterOrEqual(9)
should return \"9 or Under\"');",
+ "assert(testGreaterOrEqual(10) === \"10 or Over\", 'message: testGreaterOrEqual(10)
should return \"10 or Over\"');",
+ "assert(testGreaterOrEqual(11) === \"10 or Over\", 'message: testGreaterOrEqual(11)
should return \"10 or Over\"');",
+ "assert(testGreaterOrEqual(19) === \"10 or Over\", 'message: testGreaterOrEqual(19)
should return \"10 or Over\"');",
+ "assert(testGreaterOrEqual(100) === \"20 or Over\", 'message: testGreaterOrEqual(100)
should return \"20 or Over\"');",
+ "assert(testGreaterOrEqual(21) === \"20 or Over\", 'message: testGreaterOrEqual(21)
should return \"20 or Over\"');",
"assert(code.match(/val\\s*>=\\s*('|\")*\\d+('|\")*/g).length > 1, 'message: You should use the >=
operator at least twice');"
],
"type": "waypoint",
@@ -2950,7 +2950,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testLessThan(val) {",
" if (val) { // Change this line",
" return \"Under 25\";",
" }",
@@ -2963,18 +2963,18 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testLessThan(10);"
],
"solutions": [
- "function myTest(val) {\n if (val < 25) { // Change this line\n return \"Under 25\";\n }\n \n if (val < 55) { // Change this line\n return \"Under 55\";\n }\n\n return \"55 or Over\";\n}"
+ "function testLessThan(val) {\n if (val < 25) { // Change this line\n return \"Under 25\";\n }\n \n if (val < 55) { // Change this line\n return \"Under 55\";\n }\n\n return \"55 or Over\";\n}"
],
"tests": [
- "assert(myTest(0) === \"Under 25\", 'message: myTest(0)
should return \"Under 25\"');",
- "assert(myTest(24) === \"Under 25\", 'message: myTest(24)
should return \"Under 25\"');",
- "assert(myTest(25) === \"Under 55\", 'message: myTest(25)
should return \"Under 55\"');",
- "assert(myTest(54) === \"Under 55\", 'message: myTest(54)
should return \"Under 55\"');",
- "assert(myTest(55) === \"55 or Over\", 'message: myTest(55)
should return \"55 or Over\"');",
- "assert(myTest(99) === \"55 or Over\", 'message: myTest(99)
should return \"55 or Over\"');",
+ "assert(testLessThan(0) === \"Under 25\", 'message: testLessThan(0)
should return \"Under 25\"');",
+ "assert(testLessThan(24) === \"Under 25\", 'message: testLessThan(24)
should return \"Under 25\"');",
+ "assert(testLessThan(25) === \"Under 55\", 'message: testLessThan(25)
should return \"Under 55\"');",
+ "assert(testLessThan(54) === \"Under 55\", 'message: testLessThan(54)
should return \"Under 55\"');",
+ "assert(testLessThan(55) === \"55 or Over\", 'message: testLessThan(55)
should return \"55 or Over\"');",
+ "assert(testLessThan(99) === \"55 or Over\", 'message: testLessThan(99)
should return \"55 or Over\"');",
"assert(code.match(/val\\s*<\\s*('|\")*\\d+('|\")*/g).length > 1, 'message: You should use the <
operator at least twice');"
],
"type": "waypoint",
@@ -3000,7 +3000,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testLessOrEqual(val) {",
" if (val) { // Change this line",
" return \"Smaller Than or Equal to 12\";",
" }",
@@ -3013,20 +3013,20 @@
"}",
"",
"// Change this value to test",
- "myTest(10);",
+ "testLessOrEqual(10);",
""
],
"solutions": [
- "function myTest(val) {\n if (val <= 12) { // Change this line\n return \"Smaller Than or Equal to 12\";\n }\n \n if (val <= 24) { // Change this line\n return \"Smaller Than or Equal to 24\";\n }\n\n return \"25 or More\";\n}"
+ "function testLessOrEqual(val) {\n if (val <= 12) { // Change this line\n return \"Smaller Than or Equal to 12\";\n }\n \n if (val <= 24) { // Change this line\n return \"Smaller Than or Equal to 24\";\n }\n\n return \"25 or More\";\n}"
],
"tests": [
- "assert(myTest(0) === \"Smaller Than or Equal to 12\", 'message: myTest(0)
should return \"Smaller Than or Equal to 12\"');",
- "assert(myTest(11) === \"Smaller Than or Equal to 12\", 'message: myTest(11)
should return \"Smaller Than or Equal to 12\"');",
- "assert(myTest(12) === \"Smaller Than or Equal to 12\", 'message: myTest(12)
should return \"Smaller Than or Equal to 12\"');",
- "assert(myTest(23) === \"Smaller Than or Equal to 24\", 'message: myTest(23)
should return \"Smaller Than or Equal to 24\"');",
- "assert(myTest(24) === \"Smaller Than or Equal to 24\", 'message: myTest(24)
should return \"Smaller Than or Equal to 24\"');",
- "assert(myTest(25) === \"25 or More\", 'message: myTest(25)
should return \"25 or More\"');",
- "assert(myTest(55) === \"25 or More\", 'message: myTest(55)
should return \"25 or More\"');",
+ "assert(testLessOrEqual(0) === \"Smaller Than or Equal to 12\", 'message: testLessOrEqual(0)
should return \"Smaller Than or Equal to 12\"');",
+ "assert(testLessOrEqual(11) === \"Smaller Than or Equal to 12\", 'message: testLessOrEqual(11)
should return \"Smaller Than or Equal to 12\"');",
+ "assert(testLessOrEqual(12) === \"Smaller Than or Equal to 12\", 'message: testLessOrEqual(12)
should return \"Smaller Than or Equal to 12\"');",
+ "assert(testLessOrEqual(23) === \"Smaller Than or Equal to 24\", 'message: testLessOrEqual(23)
should return \"Smaller Than or Equal to 24\"');",
+ "assert(testLessOrEqual(24) === \"Smaller Than or Equal to 24\", 'message: testLessOrEqual(24)
should return \"Smaller Than or Equal to 24\"');",
+ "assert(testLessOrEqual(25) === \"25 or More\", 'message: testLessOrEqual(25)
should return \"25 or More\"');",
+ "assert(testLessOrEqual(55) === \"25 or More\", 'message: testLessOrEqual(55)
should return \"25 or More\"');",
"assert(code.match(/val\\s*<=\\s*('|\")*\\d+('|\")*/g).length > 1, 'message: You should use the <=
operator at least twice');"
],
"type": "waypoint",
@@ -3054,7 +3054,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testLogicalAnd(val) {",
" // Only change code below this line",
"",
" if (val) {",
@@ -3068,22 +3068,22 @@
"}",
"",
"// Change this value to test",
- "myTest(10);"
+ "testLogicalAnd(10);"
],
"solutions": [
- "function myTest(val) {\n if (val >= 25 && val <= 50) {\n return \"Yes\";\n }\n return \"No\";\n}"
+ "function testLogicalAnd(val) {\n if (val >= 25 && val <= 50) {\n return \"Yes\";\n }\n return \"No\";\n}"
],
"tests": [
"assert(code.match(/&&/g).length === 1, 'message: You should use the &&
operator once');",
"assert(code.match(/if/g).length === 1, 'message: You should only have one if
statement');",
- "assert(myTest(0) === \"No\", 'message: myTest(0)
should return \"No\"');",
- "assert(myTest(24) === \"No\", 'message: myTest(24)
should return \"No\"');",
- "assert(myTest(25) === \"Yes\", 'message: myTest(25)
should return \"Yes\"');",
- "assert(myTest(30) === \"Yes\", 'message: myTest(30)
should return \"Yes\"');",
- "assert(myTest(50) === \"Yes\", 'message: myTest(50)
should return \"Yes\"');",
- "assert(myTest(51) === \"No\", 'message: myTest(51)
should return \"No\"');",
- "assert(myTest(75) === \"No\", 'message: myTest(75)
should return \"No\"');",
- "assert(myTest(80) === \"No\", 'message: myTest(80)
should return \"No\"');"
+ "assert(testLogicalAnd(0) === \"No\", 'message: testLogicalAnd(0)
should return \"No\"');",
+ "assert(testLogicalAnd(24) === \"No\", 'message: testLogicalAnd(24)
should return \"No\"');",
+ "assert(testLogicalAnd(25) === \"Yes\", 'message: testLogicalAnd(25)
should return \"Yes\"');",
+ "assert(testLogicalAnd(30) === \"Yes\", 'message: testLogicalAnd(30)
should return \"Yes\"');",
+ "assert(testLogicalAnd(50) === \"Yes\", 'message: testLogicalAnd(50)
should return \"Yes\"');",
+ "assert(testLogicalAnd(51) === \"No\", 'message: testLogicalAnd(51)
should return \"No\"');",
+ "assert(testLogicalAnd(75) === \"No\", 'message: testLogicalAnd(75)
should return \"No\"');",
+ "assert(testLogicalAnd(80) === \"No\", 'message: testLogicalAnd(80)
should return \"No\"');"
],
"type": "waypoint",
"challengeType": 1,
@@ -3112,7 +3112,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testLogicalOr(val) {",
" // Only change code below this line",
"",
" if (val) {",
@@ -3128,22 +3128,22 @@
"}",
"",
"// Change this value to test",
- "myTest(15);"
+ "testLogicalOr(15);"
],
"solutions": [
- "function myTest(val) {\n if (val < 10 || val > 20) {\n return \"Outside\";\n }\n return \"Inside\";\n}"
+ "function testLogicalOr(val) {\n if (val < 10 || val > 20) {\n return \"Outside\";\n }\n return \"Inside\";\n}"
],
"tests": [
"assert(code.match(/\\|\\|/g).length === 1, 'message: You should use the ||
operator once');",
"assert(code.match(/if/g).length === 1, 'message: You should only have one if
statement');",
- "assert(myTest(0) === \"Outside\", 'message: myTest(0)
should return \"Outside\"');",
- "assert(myTest(9) === \"Outside\", 'message: myTest(9)
should return \"Outside\"');",
- "assert(myTest(10) === \"Inside\", 'message: myTest(10)
should return \"Inside\"');",
- "assert(myTest(15) === \"Inside\", 'message: myTest(15)
should return \"Inside\"');",
- "assert(myTest(19) === \"Inside\", 'message: myTest(19)
should return \"Inside\"');",
- "assert(myTest(20) === \"Inside\", 'message: myTest(20)
should return \"Inside\"');",
- "assert(myTest(21) === \"Outside\", 'message: myTest(21)
should return \"Outside\"');",
- "assert(myTest(25) === \"Outside\", 'message: myTest(25)
should return \"Outside\"');"
+ "assert(testLogicalOr(0) === \"Outside\", 'message: testLogicalOr(0)
should return \"Outside\"');",
+ "assert(testLogicalOr(9) === \"Outside\", 'message: testLogicalOr(9)
should return \"Outside\"');",
+ "assert(testLogicalOr(10) === \"Inside\", 'message: testLogicalOr(10)
should return \"Inside\"');",
+ "assert(testLogicalOr(15) === \"Inside\", 'message: testLogicalOr(15)
should return \"Inside\"');",
+ "assert(testLogicalOr(19) === \"Inside\", 'message: testLogicalOr(19)
should return \"Inside\"');",
+ "assert(testLogicalOr(20) === \"Inside\", 'message: testLogicalOr(20)
should return \"Inside\"');",
+ "assert(testLogicalOr(21) === \"Outside\", 'message: testLogicalOr(21)
should return \"Outside\"');",
+ "assert(testLogicalOr(25) === \"Outside\", 'message: testLogicalOr(25)
should return \"Outside\"');"
],
"type": "waypoint",
"challengeType": 1,
@@ -3169,7 +3169,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testElse(val) {",
" var result = \"\";",
" // Only change code below this line",
" ",
@@ -3186,19 +3186,19 @@
"}",
"",
"// Change this value to test",
- "myTest(4);",
+ "testElse(4);",
""
],
"solutions": [
- "function myTest(val) {\n var result = \"\";\n if(val > 5) {\n result = \"Bigger than 5\";\n } else {\n result = \"5 or Smaller\";\n }\n return result;\n}"
+ "function testElse(val) {\n var result = \"\";\n if(val > 5) {\n result = \"Bigger than 5\";\n } else {\n result = \"5 or Smaller\";\n }\n return result;\n}"
],
"tests": [
"assert(code.match(/if/g).length === 1, 'message: You should only have one if
statement');",
"assert(/else/g.test(code), 'message: You should use an else
statement');",
- "assert(myTest(4) === \"5 or Smaller\", 'message: myTest(4)
should return \"5 or Smaller\"');",
- "assert(myTest(5) === \"5 or Smaller\", 'message: myTest(5)
should return \"5 or Smaller\"');",
- "assert(myTest(6) === \"Bigger than 5\", 'message: myTest(6)
should return \"Bigger than 5\"');",
- "assert(myTest(10) === \"Bigger than 5\", 'message: myTest(10)
should return \"Bigger than 5\"');",
+ "assert(testElse(4) === \"5 or Smaller\", 'message: testElse(4)
should return \"5 or Smaller\"');",
+ "assert(testElse(5) === \"5 or Smaller\", 'message: testElse(5)
should return \"5 or Smaller\"');",
+ "assert(testElse(6) === \"Bigger than 5\", 'message: testElse(6)
should return \"Bigger than 5\"');",
+ "assert(testElse(10) === \"Bigger than 5\", 'message: testElse(10)
should return \"Bigger than 5\"');",
"assert(/var result = \"\";/.test(code) && /return result;/.test(code), 'message: Do not change the code above or below the lines.');"
],
"type": "waypoint",
@@ -3222,7 +3222,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function testElseIf(val) {",
" if (val > 10) {",
" return \"Greater than 10\";",
" }",
@@ -3235,20 +3235,20 @@
"}",
"",
"// Change this value to test",
- "myTest(7);",
+ "testElseIf(7);",
""
],
"solutions": [
- "function myTest(val) {\n if(val > 10) {\n return \"Greater than 10\";\n } else if(val < 5) {\n return \"Smaller than 5\";\n } else {\n return \"Between 5 and 10\";\n }\n}"
+ "function testElseIf(val) {\n if(val > 10) {\n return \"Greater than 10\";\n } else if(val < 5) {\n return \"Smaller than 5\";\n } else {\n return \"Between 5 and 10\";\n }\n}"
],
"tests": [
"assert(code.match(/else/g).length > 1, 'message: You should have at least two else
statements');",
"assert(code.match(/if/g).length > 1, 'message: You should have at least two if
statements');",
- "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(0)
should return \"Smaller than 5\"');",
- "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5)
should return \"Between 5 and 10\"');",
- "assert(myTest(7) === \"Between 5 and 10\", 'message: myTest(7)
should return \"Between 5 and 10\"');",
- "assert(myTest(10) === \"Between 5 and 10\", 'message: myTest(10)
should return \"Between 5 and 10\"');",
- "assert(myTest(12) === \"Greater than 10\", 'message: myTest(12)
should return \"Greater than 10\"');"
+ "assert(testElseIf(0) === \"Smaller than 5\", 'message: testElseIf(0)
should return \"Smaller than 5\"');",
+ "assert(testElseIf(5) === \"Between 5 and 10\", 'message: testElseIf(5)
should return \"Between 5 and 10\"');",
+ "assert(testElseIf(7) === \"Between 5 and 10\", 'message: testElseIf(7)
should return \"Between 5 and 10\"');",
+ "assert(testElseIf(10) === \"Between 5 and 10\", 'message: testElseIf(10)
should return \"Between 5 and 10\"');",
+ "assert(testElseIf(12) === \"Greater than 10\", 'message: testElseIf(12)
should return \"Greater than 10\"');"
],
"type": "waypoint",
"challengeType": 1,
@@ -3277,7 +3277,7 @@
"Change the order of logic in the function so that it will return the correct statements in all cases."
],
"challengeSeed": [
- "function myTest(val) {",
+ "function orderMyLogic(val) {",
" if (val < 10) {",
" return \"Less than 10\";",
" } else if (val < 5) {",
@@ -3288,15 +3288,15 @@
"}",
"",
"// Change this value to test",
- "myTest(7);"
+ "orderMyLogic(7);"
],
"solutions": [
- "function myTest(val) {\n if(val < 5) {\n return \"Less than 5\"; \n } else if (val < 10) {\n return \"Less than 10\";\n } else {\n return \"Greater than or equal to 10\";\n }\n}"
+ "function orderMyLogic(val) {\n if(val < 5) {\n return \"Less than 5\"; \n } else if (val < 10) {\n return \"Less than 10\";\n } else {\n return \"Greater than or equal to 10\";\n }\n}"
],
"tests": [
- "assert(myTest(4) === \"Less than 5\", 'message: myTest(4)
should return \"Less than 5\"');",
- "assert(myTest(6) === \"Less than 10\", 'message: myTest(6)
should return \"Less than 10\"');",
- "assert(myTest(11) === \"Greater than or equal to 10\", 'message: myTest(11)
should return \"Greater than or equal to 10\"');"
+ "assert(orderMyLogic(4) === \"Less than 5\", 'message: orderMyLogic(4)
should return \"Less than 5\"');",
+ "assert(orderMyLogic(6) === \"Less than 10\", 'message: orderMyLogic(6)
should return \"Less than 10\"');",
+ "assert(orderMyLogic(11) === \"Greater than or equal to 10\", 'message: orderMyLogic(11)
should return \"Greater than or equal to 10\"');"
],
"type": "waypoint",
"challengeType": 1,
@@ -3327,7 +3327,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(num) {",
+ "function testSize(num) {",
" // Only change code below this line",
" ",
" ",
@@ -3336,25 +3336,25 @@
"}",
"",
"// Change this value to test",
- "myTest(7);"
+ "testSize(7);"
],
"solutions": [
- "function myTest(num) {\n if (num < 5) {\n return \"Tiny\";\n } else if (num < 10) {\n return \"Small\";\n } else if (num < 15) {\n return \"Medium\";\n } else if (num < 20) {\n return \"Large\";\n } else {\n return \"Huge\";\n }\n}"
+ "function testSize(num) {\n if (num < 5) {\n return \"Tiny\";\n } else if (num < 10) {\n return \"Small\";\n } else if (num < 15) {\n return \"Medium\";\n } else if (num < 20) {\n return \"Large\";\n } else {\n return \"Huge\";\n }\n}"
],
"tests": [
"assert(code.match(/else/g).length > 3, 'message: You should have at least four else
statements');",
"assert(code.match(/if/g).length > 3, 'message: You should have at least four if
statements');",
"assert(code.match(/return/g).length >= 1, 'message: You should have at least one return
statement');",
- "assert(myTest(0) === \"Tiny\", 'message: myTest(0)
should return \"Tiny\"');",
- "assert(myTest(4) === \"Tiny\", 'message: myTest(4)
should return \"Tiny\"');",
- "assert(myTest(5) === \"Small\", 'message: myTest(5)
should return \"Small\"');",
- "assert(myTest(8) === \"Small\", 'message: myTest(8)
should return \"Small\"');",
- "assert(myTest(10) === \"Medium\", 'message: myTest(10)
should return \"Medium\"');",
- "assert(myTest(14) === \"Medium\", 'message: myTest(14)
should return \"Medium\"');",
- "assert(myTest(15) === \"Large\", 'message: myTest(15)
should return \"Large\"');",
- "assert(myTest(17) === \"Large\", 'message: myTest(17)
should return \"Large\"');",
- "assert(myTest(20) === \"Huge\", 'message: myTest(20)
should return \"Huge\"');",
- "assert(myTest(25) === \"Huge\", 'message: myTest(25)
should return \"Huge\"');"
+ "assert(testSize(0) === \"Tiny\", 'message: testSize(0)
should return \"Tiny\"');",
+ "assert(testSize(4) === \"Tiny\", 'message: testSize(4)
should return \"Tiny\"');",
+ "assert(testSize(5) === \"Small\", 'message: testSize(5)
should return \"Small\"');",
+ "assert(testSize(8) === \"Small\", 'message: testSize(8)
should return \"Small\"');",
+ "assert(testSize(10) === \"Medium\", 'message: testSize(10)
should return \"Medium\"');",
+ "assert(testSize(14) === \"Medium\", 'message: testSize(14)
should return \"Medium\"');",
+ "assert(testSize(15) === \"Large\", 'message: testSize(15)
should return \"Large\"');",
+ "assert(testSize(17) === \"Large\", 'message: testSize(17)
should return \"Large\"');",
+ "assert(testSize(20) === \"Huge\", 'message: testSize(20)
should return \"Huge\"');",
+ "assert(testSize(25) === \"Huge\", 'message: testSize(25)
should return \"Huge\"');"
],
"type": "waypoint",
"challengeType": 1,
@@ -3428,7 +3428,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function caseInSwitch(val) {",
" var answer = \"\";",
" // Only change code below this line",
" ",
@@ -3439,20 +3439,20 @@
"}",
"",
"// Change this value to test",
- "myTest(1);",
+ "caseInSwitch(1);",
""
],
"solutions": [
- "function myTest(val) {\n var answer = \"\";\n\n switch (val) {\n case 1:\n answer = \"alpha\";\n break;\n case 2:\n answer = \"beta\";\n break;\n case 3:\n answer = \"gamma\";\n break;\n case 4:\n answer = \"delta\";\n }\n return answer; \n}"
+ "function caseInSwitch(val) {\n var answer = \"\";\n\n switch (val) {\n case 1:\n answer = \"alpha\";\n break;\n case 2:\n answer = \"beta\";\n break;\n case 3:\n answer = \"gamma\";\n break;\n case 4:\n answer = \"delta\";\n }\n return answer; \n}"
],
"MDNlinks": [
"Switch Statement"
],
"tests": [
- "assert(myTest(1) === \"alpha\", 'message: myTest(1) should have a value of \"alpha\"');",
- "assert(myTest(2) === \"beta\", 'message: myTest(2) should have a value of \"beta\"');",
- "assert(myTest(3) === \"gamma\", 'message: myTest(3) should have a value of \"gamma\"');",
- "assert(myTest(4) === \"delta\", 'message: myTest(4) should have a value of \"delta\"');",
+ "assert(caseInSwitch(1) === \"alpha\", 'message: caseInSwitch(1) should have a value of \"alpha\"');",
+ "assert(caseInSwitch(2) === \"beta\", 'message: caseInSwitch(2) should have a value of \"beta\"');",
+ "assert(caseInSwitch(3) === \"gamma\", 'message: caseInSwitch(3) should have a value of \"gamma\"');",
+ "assert(caseInSwitch(4) === \"delta\", 'message: caseInSwitch(4) should have a value of \"delta\"');",
"assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if
or else
statements');",
"assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break
statements');"
],
@@ -3480,7 +3480,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function switchOfStuff(val) {",
" var answer = \"\";",
" // Only change code below this line",
" ",
@@ -3491,18 +3491,18 @@
"}",
"",
"// Change this value to test",
- "myTest(1);",
+ "switchOfStuff(1);",
""
],
"solutions": [
- "function myTest(val) {\n var answer = \"\";\n\n switch(val) {\n case \"a\":\n answer = \"apple\";\n break;\n case \"b\":\n answer = \"bird\";\n break;\n case \"c\":\n answer = \"cat\";\n break;\n default:\n answer = \"stuff\";\n }\n return answer; \n}"
+ "function switchOfStuff(val) {\n var answer = \"\";\n\n switch(val) {\n case \"a\":\n answer = \"apple\";\n break;\n case \"b\":\n answer = \"bird\";\n break;\n case \"c\":\n answer = \"cat\";\n break;\n default:\n answer = \"stuff\";\n }\n return answer; \n}"
],
"tests": [
- "assert(myTest(\"a\") === \"apple\", 'message: myTest(\"a\") should have a value of \"apple\"');",
- "assert(myTest(\"b\") === \"bird\", 'message: myTest(\"b\") should have a value of \"bird\"');",
- "assert(myTest(\"c\") === \"cat\", 'message: myTest(\"c\") should have a value of \"cat\"');",
- "assert(myTest(\"d\") === \"stuff\", 'message: myTest(\"d\") should have a value of \"stuff\"');",
- "assert(myTest(4) === \"stuff\", 'message: myTest(4) should have a value of \"stuff\"');",
+ "assert(switchOfStuff(\"a\") === \"apple\", 'message: switchOfStuff(\"a\") should have a value of \"apple\"');",
+ "assert(switchOfStuff(\"b\") === \"bird\", 'message: switchOfStuff(\"b\") should have a value of \"bird\"');",
+ "assert(switchOfStuff(\"c\") === \"cat\", 'message: switchOfStuff(\"c\") should have a value of \"cat\"');",
+ "assert(switchOfStuff(\"d\") === \"stuff\", 'message: switchOfStuff(\"d\") should have a value of \"stuff\"');",
+ "assert(switchOfStuff(4) === \"stuff\", 'message: switchOfStuff(4) should have a value of \"stuff\"');",
"assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if
or else
statements');",
"assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break
statements');"
],
@@ -3530,7 +3530,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function sequentialSizes(val) {",
" var answer = \"\";",
" // Only change code below this line",
" ",
@@ -3541,22 +3541,22 @@
"}",
"",
"// Change this value to test",
- "myTest(1);",
+ "sequentialSizes(1);",
""
],
"solutions": [
- "function myTest(val) {\n var answer = \"\";\n \n switch (val) {\n case 1:\n case 2:\n case 3:\n answer = \"Low\";\n break;\n case 4:\n case 5:\n case 6:\n answer = \"Mid\";\n break;\n case 7:\n case 8:\n case 9:\n answer = \"High\";\n }\n \n return answer; \n}"
+ "function sequentialSizes(val) {\n var answer = \"\";\n \n switch (val) {\n case 1:\n case 2:\n case 3:\n answer = \"Low\";\n break;\n case 4:\n case 5:\n case 6:\n answer = \"Mid\";\n break;\n case 7:\n case 8:\n case 9:\n answer = \"High\";\n }\n \n return answer; \n}"
],
"tests": [
- "assert(myTest(1) === \"Low\", 'message: myTest(1)
should return \"Low\"');",
- "assert(myTest(2) === \"Low\", 'message: myTest(2)
should return \"Low\"');",
- "assert(myTest(3) === \"Low\", 'message: myTest(3)
should return \"Low\"');",
- "assert(myTest(4) === \"Mid\", 'message: myTest(4)
should return \"Mid\"');",
- "assert(myTest(5) === \"Mid\", 'message: myTest(5)
should return \"Mid\"');",
- "assert(myTest(6) === \"Mid\", 'message: myTest(6)
should return \"Mid\"');",
- "assert(myTest(7) === \"High\", 'message: myTest(7)
should return \"High\"');",
- "assert(myTest(8) === \"High\", 'message: myTest(8)
should return \"High\"');",
- "assert(myTest(9) === \"High\", 'message: myTest(9)
should return \"High\"');",
+ "assert(sequentialSizes(1) === \"Low\", 'message: sequentialSizes(1)
should return \"Low\"');",
+ "assert(sequentialSizes(2) === \"Low\", 'message: sequentialSizes(2)
should return \"Low\"');",
+ "assert(sequentialSizes(3) === \"Low\", 'message: sequentialSizes(3)
should return \"Low\"');",
+ "assert(sequentialSizes(4) === \"Mid\", 'message: sequentialSizes(4)
should return \"Mid\"');",
+ "assert(sequentialSizes(5) === \"Mid\", 'message: sequentialSizes(5)
should return \"Mid\"');",
+ "assert(sequentialSizes(6) === \"Mid\", 'message: sequentialSizes(6)
should return \"Mid\"');",
+ "assert(sequentialSizes(7) === \"High\", 'message: sequentialSizes(7)
should return \"High\"');",
+ "assert(sequentialSizes(8) === \"High\", 'message: sequentialSizes(8)
should return \"High\"');",
+ "assert(sequentialSizes(9) === \"High\", 'message: sequentialSizes(9)
should return \"High\"');",
"assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if
or else
statements');",
"assert(code.match(/case/g).length === 9, 'message: You should have nine case
statements');"
],
@@ -3585,7 +3585,7 @@
],
"releasedOn": "January 1, 2016",
"challengeSeed": [
- "function myTest(val) {",
+ "function chainToSwitch(val) {",
" var answer = \"\";",
" // Only change code below this line",
" ",
@@ -3606,23 +3606,23 @@
"}",
"",
"// Change this value to test",
- "myTest(7);",
+ "chainToSwitch(7);",
""
],
"solutions": [
- "function myTest(val) {\n var answer = \"\";\n\n switch (val) {\n case \"bob\":\n answer = \"Marley\";\n break;\n case 42:\n answer = \"The Answer\";\n break;\n case 1:\n answer = \"There is no #1\";\n break;\n case 99:\n answer = \"Missed me by this much!\";\n break;\n case 7:\n answer = \"Ate Nine\";\n }\n return answer; \n}"
+ "function chainToSwitch(val) {\n var answer = \"\";\n\n switch (val) {\n case \"bob\":\n answer = \"Marley\";\n break;\n case 42:\n answer = \"The Answer\";\n break;\n case 1:\n answer = \"There is no #1\";\n break;\n case 99:\n answer = \"Missed me by this much!\";\n break;\n case 7:\n answer = \"Ate Nine\";\n }\n return answer; \n}"
],
"tests": [
"assert(!/else/g.test(code), 'message: You should not use any else
statements');",
"assert(!/if/g.test(code), 'message: You should not use any if
statements');",
"assert(code.match(/break/g).length >= 4, 'message: You should have at least four break
statements');",
- "assert(myTest(\"bob\") === \"Marley\", 'message: myTest(\"bob\")
should be \"Marley\"');",
- "assert(myTest(42) === \"The Answer\", 'message: myTest(42)
should be \"The Answer\"');",
- "assert(myTest(1) === \"There is no #1\", 'message: myTest(1)
should be \"There is no #1\"');",
- "assert(myTest(99) === \"Missed me by this much!\", 'message: myTest(99)
should be \"Missed me by this much!\"');",
- "assert(myTest(7) === \"Ate Nine\", 'message: myTest(7)
should be \"Ate Nine\"');",
- "assert(myTest(\"John\") === \"\", 'message: myTest(\"John\")
should be \"\" (empty string)');",
- "assert(myTest(156) === \"\", 'message: myTest(156)
should be \"\" (empty string)');"
+ "assert(chainToSwitch(\"bob\") === \"Marley\", 'message: chainToSwitch(\"bob\")
should be \"Marley\"');",
+ "assert(chainToSwitch(42) === \"The Answer\", 'message: chainToSwitch(42)
should be \"The Answer\"');",
+ "assert(chainToSwitch(1) === \"There is no #1\", 'message: chainToSwitch(1)
should be \"There is no #1\"');",
+ "assert(chainToSwitch(99) === \"Missed me by this much!\", 'message: chainToSwitch(99)
should be \"Missed me by this much!\"');",
+ "assert(chainToSwitch(7) === \"Ate Nine\", 'message: chainToSwitch(7)
should be \"Ate Nine\"');",
+ "assert(chainToSwitch(\"John\") === \"\", 'message: chainToSwitch(\"John\")
should be \"\" (empty string)');",
+ "assert(chainToSwitch(156) === \"\", 'message: chainToSwitch(156)
should be \"\" (empty string)');"
],
"type": "waypoint",
"challengeType": 1,
@@ -4524,27 +4524,27 @@
"var collectionCopy = JSON.parse(JSON.stringify(collection));",
"",
"// Only change code below this line",
- "function update(id, prop, value) {",
+ "function updateRecords(id, prop, value) {",
"",
"",
" return collection;",
"}",
"",
"// Alter values below to test your code",
- "update(5439, \"artist\", \"ABBA\");",
+ "updateRecords(5439, \"artist\", \"ABBA\");",
""
],
"tail": [
"(function(x) { return \"collection = \\n\" + JSON.stringify(x, '\\n', 2); })(collection);"
],
"solutions": [
- "var collection = {\n 2548: {\n album: \"Slippery When Wet\",\n artist: \"Bon Jovi\",\n tracks: [ \n \"Let It Rock\", \n \"You Give Love a Bad Name\" \n ]\n },\n 2468: {\n album: \"1999\",\n artist: \"Prince\",\n tracks: [ \n \"1999\", \n \"Little Red Corvette\" \n ]\n },\n 1245: {\n artist: \"Robert Palmer\",\n tracks: [ ]\n },\n 5439: {\n album: \"ABBA Gold\"\n }\n};\n// Keep a copy of the collection for tests\nvar collectionCopy = JSON.parse(JSON.stringify(collection));\n\n// Only change code below this line\nfunction update(id, prop, value) {\n if(value !== \"\") {\n if(prop === \"tracks\") {\n collection[id][prop].push(value);\n } else {\n collection[id][prop] = value;\n }\n } else {\n delete collection[id][prop];\n }\n\n return collection;\n}"
+ "var collection = {\n 2548: {\n album: \"Slippery When Wet\",\n artist: \"Bon Jovi\",\n tracks: [ \n \"Let It Rock\", \n \"You Give Love a Bad Name\" \n ]\n },\n 2468: {\n album: \"1999\",\n artist: \"Prince\",\n tracks: [ \n \"1999\", \n \"Little Red Corvette\" \n ]\n },\n 1245: {\n artist: \"Robert Palmer\",\n tracks: [ ]\n },\n 5439: {\n album: \"ABBA Gold\"\n }\n};\n// Keep a copy of the collection for tests\nvar collectionCopy = JSON.parse(JSON.stringify(collection));\n\n// Only change code below this line\nfunction updateRecords(id, prop, value) {\n if(value !== \"\") {\n if(prop === \"tracks\") {\n collection[id][prop].push(value);\n } else {\n collection[id][prop] = value;\n }\n } else {\n delete collection[id][prop];\n }\n\n return collection;\n}"
],
"tests": [
- "collection = collectionCopy; assert(update(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After update(5439, \"artist\", \"ABBA\")
, artist
should be \"ABBA\"
');",
- "update(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After update(2548, \"artist\", \"\")
, artist
should not be set');",
- "assert(update(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].pop() === \"Addicted to Love\", 'message: After update(1245, \"tracks\", \"Addicted to Love\")
, tracks
should have \"Addicted to Love\"
as the last element.');",
- "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\")
, tracks
should not be set');"
+ "collection = collectionCopy; assert(updateRecords(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After updateRecords(5439, \"artist\", \"ABBA\")
, artist
should be \"ABBA\"
');",
+ "updateRecords(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After updateRecords(2548, \"artist\", \"\")
, artist
should not be set');",
+ "assert(updateRecords(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].pop() === \"Addicted to Love\", 'message: After updateRecords(1245, \"tracks\", \"Addicted to Love\")
, tracks
should have \"Addicted to Love\"
as the last element.');",
+ "updateRecords(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After updateRecords(2548, \"tracks\", \"\")
, tracks
should not be set');"
],
"type": "checkpoint",
"challengeType": 1,
@@ -4915,24 +4915,24 @@
"];",
"",
"",
- "function lookUp(firstName, prop){",
+ "function lookUpProfile(firstName, prop){",
"// Only change code below this line",
"",
"// Only change code above this line",
"}",
"",
"// Change these values to test your function",
- "lookUp(\"Akira\", \"likes\");"
+ "lookUpProfile(\"Akira\", \"likes\");"
],
"solutions": [
- "var contacts = [\n {\n \"firstName\": \"Akira\",\n \"lastName\": \"Laine\",\n \"number\": \"0543236543\",\n \"likes\": [\"Pizza\", \"Coding\", \"Brownie Points\"]\n },\n {\n \"firstName\": \"Harry\",\n \"lastName\": \"Potter\",\n \"number\": \"0994372684\",\n \"likes\": [\"Hogwarts\", \"Magic\", \"Hagrid\"]\n },\n {\n \"firstName\": \"Sherlock\",\n \"lastName\": \"Holmes\",\n \"number\": \"0487345643\",\n \"likes\": [\"Intriguing Cases\", \"Violin\"]\n },\n {\n \"firstName\": \"Kristian\",\n \"lastName\": \"Vos\",\n \"number\": \"unknown\",\n \"likes\": [\"Javascript\", \"Gaming\", \"Foxes\"]\n },\n];\n\n\n//Write your function in between these comments\nfunction lookUp(name, prop){\n for(var i in contacts){\n if(contacts[i].firstName === name) {\n return contacts[i][prop] || \"No such property\";\n }\n }\n return \"No such contact\";\n}\n//Write your function in between these comments\n\nlookUp(\"Akira\", \"likes\");"
+ "var contacts = [\n {\n \"firstName\": \"Akira\",\n \"lastName\": \"Laine\",\n \"number\": \"0543236543\",\n \"likes\": [\"Pizza\", \"Coding\", \"Brownie Points\"]\n },\n {\n \"firstName\": \"Harry\",\n \"lastName\": \"Potter\",\n \"number\": \"0994372684\",\n \"likes\": [\"Hogwarts\", \"Magic\", \"Hagrid\"]\n },\n {\n \"firstName\": \"Sherlock\",\n \"lastName\": \"Holmes\",\n \"number\": \"0487345643\",\n \"likes\": [\"Intriguing Cases\", \"Violin\"]\n },\n {\n \"firstName\": \"Kristian\",\n \"lastName\": \"Vos\",\n \"number\": \"unknown\",\n \"likes\": [\"Javascript\", \"Gaming\", \"Foxes\"]\n },\n];\n\n\n//Write your function in between these comments\nfunction lookUpProfile(name, prop){\n for(var i in contacts){\n if(contacts[i].firstName === name) {\n return contacts[i][prop] || \"No such property\";\n }\n }\n return \"No such contact\";\n}\n//Write your function in between these comments\n\nlookUpProfile(\"Akira\", \"likes\");"
],
"tests": [
- "assert(lookUp('Kristian','lastName') === \"Vos\", 'message: \"Kristian\", \"lastName\"
should return \"Vos\"
');",
- "assert.deepEqual(lookUp(\"Sherlock\", \"likes\"), [\"Intriguing Cases\", \"Violin\"], 'message: \"Sherlock\", \"likes\"
should return [\"Intriguing Cases\", \"Violin\"]
');",
- "assert(typeof lookUp(\"Harry\", \"likes\") === \"object\", 'message: \"Harry\",\"likes\"
should return an array');",
- "assert(lookUp(\"Bob\", \"number\") === \"No such contact\", 'message: \"Bob\", \"number\"
should return \"No such contact\"');",
- "assert(lookUp(\"Akira\", \"address\") === \"No such property\", 'message: \"Akira\", \"address\"
should return \"No such property\"');"
+ "assert(lookUpProfile('Kristian','lastName') === \"Vos\", 'message: \"Kristian\", \"lastName\"
should return \"Vos\"
');",
+ "assert.deepEqual(lookUpProfile(\"Sherlock\", \"likes\"), [\"Intriguing Cases\", \"Violin\"], 'message: \"Sherlock\", \"likes\"
should return [\"Intriguing Cases\", \"Violin\"]
');",
+ "assert(typeof lookUpProfile(\"Harry\", \"likes\") === \"object\", 'message: \"Harry\",\"likes\"
should return an array');",
+ "assert(lookUpProfile(\"Bob\", \"number\") === \"No such contact\", 'message: \"Bob\", \"number\"
should return \"No such contact\"');",
+ "assert(lookUpProfile(\"Akira\", \"address\") === \"No such property\", 'message: \"Akira\", \"address\"
should return \"No such property\"');"
],
"type": "checkpoint",
"challengeType": 1,
@@ -4955,10 +4955,10 @@
"JavaScript has a Math.random()
function that generates a random decimal number between 0
(inclusive) and not quite up to 1
(exclusive). Thus Math.random()
can return a 0
but never quite return a 1
",
"Note
Like Storing Values with the Equal Operator, all function calls will be resolved before the return
executes, so we can simply return
the value of the Math.random()
function.",
"Instructions
",
- "Change myFunction
to return a random number instead of returning 0
."
+ "Change randomFraction
to return a random number instead of returning 0
."
],
"challengeSeed": [
- "function myFunction() {",
+ "function randomFraction() {",
"",
" // Only change code below this line.",
"",
@@ -4968,14 +4968,14 @@
"}"
],
"tail": [
- "(function(){return myFunction();})();"
+ "(function(){return randomFraction();})();"
],
"solutions": [
- "function myFunction() {\n return Math.random();\n}"
+ "function randomFraction() {\n return Math.random();\n}"
],
"tests": [
- "assert(typeof myFunction() === \"number\", 'message: myFunction
should return a random number.');",
- "assert((myFunction()+''). match(/\\./g), 'message: The number returned by myFunction
should be a decimal.');",
+ "assert(typeof randomFraction() === \"number\", 'message: randomFraction
should return a random number.');",
+ "assert((randomFraction()+''). match(/\\./g), 'message: The number returned by randomFraction
should be a decimal.');",
"assert(code.match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random
to generate the random decimal number.');"
],
"type": "waypoint",
@@ -4985,7 +4985,7 @@
"Los números aleatorios son útiles para crear un comportamiento aleatorio.",
"JavaScript tiene una función Math.random()
que genera un número decimal aleatorio.",
"Instrucciones
",
- "Cambia myFunction
para que devuelva un número al azar en lugar de devolver 0
.",
+ "Cambia randomFraction
para que devuelva un número al azar en lugar de devolver 0
.",
"Ten en cuenta que puedes retornar lo retornado por una función, igual que harías para devolver una variable o valor."
]
},
@@ -5005,7 +5005,7 @@
"challengeSeed": [
"var randomNumberBetween0and19 = Math.floor(Math.random() * 20);",
"",
- "function myFunction() {",
+ "function randomWholeNum() {",
"",
" // Only change code below this line.",
"",
@@ -5013,13 +5013,13 @@
"}"
],
"tail": [
- "(function(){return myFunction();})();"
+ "(function(){return randomWholeNum();})();"
],
"solutions": [
- "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);\n\nfunction myFunction() {\n return Math.floor(Math.random() * 10);\n}"
+ "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);\n\nfunction randomWholeNum() {\n return Math.floor(Math.random() * 10);\n}"
],
"tests": [
- "assert(typeof myFunction() === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction
should be a whole number.');",
+ "assert(typeof randomWholeNum() === \"number\" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})(), 'message: The result of randomWholeNum
should be a whole number.');",
"assert(code.match(/Math.random/g).length > 1, 'message: You should be using Math.random
to generate a random number.');",
"assert(code.match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || code.match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'message: You should have multiplied the result of Math.random
by 10 to make it a number that is between zero and nine.');",
"assert(code.match(/Math.floor/g).length > 1, 'message: You should use Math.floor
to remove the decimal part of the number.');"
diff --git a/seed/challenges/01-front-end-development-certification/intermediate-bonfires.json b/seed/challenges/01-front-end-development-certification/intermediate-bonfires.json
index 76bccd494b..d95e51cd8e 100644
--- a/seed/challenges/01-front-end-development-certification/intermediate-bonfires.json
+++ b/seed/challenges/01-front-end-development-certification/intermediate-bonfires.json
@@ -177,8 +177,12 @@
],
"challengeSeed": [
"function whereAreYou(collection, source) {",
- " var arr = [];",
" // What's in a name?",
+ " var arr = [];",
+ " // Only change code below this line",
+ " ",
+ " ",
+ " // Only change code above this line",
" return arr;",
"}",
"",
diff --git a/server/boot/about.js b/server/boot/about.js
index e310bc4566..7e596394f3 100644
--- a/server/boot/about.js
+++ b/server/boot/about.js
@@ -1,32 +1,59 @@
+import { Observable } from 'rx';
import dedent from 'dedent';
import moment from 'moment';
-import { observeMethod } from '../utils/rx';
+import { timeCache, observeMethod } from '../utils/rx';
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
+// userCount(where: Object) => Observable[Number]
+// getCertCount(userCount: userCount, cert: String) => Observable[Number]
+function getCertCount(userCount, cert) {
+ return userCount({ [cert]: true })
+ // using This-Bind operator
+ ::timeCache(2, 'hours');
+}
+
export default function about(app) {
const router = app.loopback.Router();
const User = app.models.User;
- const userCount$ = observeMethod(User, 'count');
+ const userCount = observeMethod(User, 'count');
+ const frontEndCount$ = getCertCount(userCount, 'isFrontEndCert');
+ const dataVisCount$ = getCertCount(userCount, 'isDataVisCert');
+ const backEndCount$ = getCertCount(userCount, 'isBackEndCert');
function showAbout(req, res, next) {
const daysRunning = moment().diff(new Date('10/15/2014'), 'days');
- userCount$()
- .map(camperCount => numberWithCommas(camperCount))
- .doOnNext(camperCount => {
+ Observable.combineLatest(
+ frontEndCount$,
+ dataVisCount$,
+ backEndCount$,
+ (frontEndCount = 0, dataVisCount = 0, backEndCount = 0) => ({
+ frontEndCount,
+ dataVisCount,
+ backEndCount
+ })
+ )
+ .doOnNext(({ frontEndCount, dataVisCount, backEndCount }) => {
res.render('resources/about', {
- camperCount,
+ frontEndCount: numberWithCommas(frontEndCount),
+ dataVisCount: numberWithCommas(dataVisCount),
+ backEndCount: numberWithCommas(backEndCount),
daysRunning,
title: dedent`
About our Open Source Community, our social media presence,
- and how to contact us`.split('\n').join(' '),
+ and how to contact us
+ `.split('\n').join(' '),
globalCompletedCount: numberWithCommas(
5612952 + (Math.floor((Date.now() - 1446268581061) / 1800))
- )
+ ),
+ globalPledgedAmount: numberWithCommas(Math.floor(
+ 28000 +
+ ((Date.now() - 1456207176902) / (2629746000 / 2000) * 8.30)
+ ))
});
})
.subscribe(() => {}, next);
diff --git a/server/boot/randomAPIs.js b/server/boot/randomAPIs.js
index 2995082fb2..f12a270843 100644
--- a/server/boot/randomAPIs.js
+++ b/server/boot/randomAPIs.js
@@ -43,6 +43,7 @@ module.exports = function(app) {
router.get('/how-nonprofit-projects-work', howNonprofitProjectsWork);
router.get('/code-of-conduct', codeOfConduct);
router.get('/academic-honesty', academicHonesty);
+ router.get('/news', news);
router.get(
'/the-fastest-web-page-on-the-internet',
@@ -284,6 +285,12 @@ module.exports = function(app) {
});
}
+ function news(req, res) {
+ res.render('resources/camper-news-deprecated', {
+ title: 'Camper News'
+ });
+ }
+
function twitch(req, res) {
res.redirect('https://twitch.tv/freecodecamp');
}
diff --git a/server/boot/story.js b/server/boot/story.js
index 2fba520ed6..4d1ca77660 100755
--- a/server/boot/story.js
+++ b/server/boot/story.js
@@ -78,7 +78,6 @@ module.exports = function(app) {
);
router.post('/stories/preliminary', ifNoUser401, newStory);
router.post('/stories/', ifNoUser401, storySubmission);
- router.get('/news/', hot);
router.post('/stories/search', getStories);
router.get('/news/:storyName', returnIndividualStory);
router.post('/stories/upvote/', ifNoUser401, upvote);
@@ -127,13 +126,6 @@ module.exports = function(app) {
);
}
- function hot(req, res) {
- return res.render('stories/index', {
- title: 'Top Stories on Camper News',
- page: 'hot'
- });
- }
-
function submitNew(req, res) {
if (!req.user.isGithubCool) {
req.flash('errors', {
diff --git a/server/utils/rx.js b/server/utils/rx.js
index 891d24e9f3..20976dfeb8 100644
--- a/server/utils/rx.js
+++ b/server/utils/rx.js
@@ -1,4 +1,5 @@
-import Rx from 'rx';
+import Rx, { AsyncSubject, Observable } from 'rx';
+import moment from 'moment';
import debugFactory from 'debug';
const debug = debugFactory('fcc:rxUtils');
@@ -31,3 +32,22 @@ export function observeQuery(Model, method, query) {
export function observeMethod(context, methodName) {
return Rx.Observable.fromNodeCallback(context[methodName], context);
}
+
+// timeChache(amount: Number, unit: String) => Observable
+export function timeCache(time, unit) {
+ const source = this;
+ let cache;
+ let expireCacheAt;
+ return Observable.create(observable => {
+ // if there is no expire time set
+ // or if expireCacheAt is smaller than now,
+ // set new expire time in MS and create new subscription to source
+ if (!expireCacheAt || expireCacheAt < Date.now()) {
+ // set expire in ms;
+ expireCacheAt = moment().add(time, unit).valueOf();
+ cache = new AsyncSubject();
+ source.subscribe(cache);
+ }
+ return cache.subscribe(observable);
+ });
+}
diff --git a/server/views/account/settings.jade b/server/views/account/settings.jade
index 822aa10d24..e83f9cc4cd 100644
--- a/server/views/account/settings.jade
+++ b/server/views/account/settings.jade
@@ -17,18 +17,10 @@ block content
a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/link/twitter')
i.fa.fa-twitter
| Add my Twitter to my portfolio
- if (!user.facebook)
- a.btn.btn-lg.btn-block.btn-facebook.btn-link-social(href='/link/facebook')
- i.fa.fa-facebook
- | Add my Facebook to my portfolio
if (!user.linkedin)
a.btn.btn-lg.btn-block.btn-linkedin.btn-link-social(href='/link/linkedin')
i.fa.fa-linkedin
| Add my LinkedIn to my portfolio
- if (!user.google)
- a.btn.btn-lg.btn-block.btn-google.btn-link-social(href='/link/google')
- i.fa.fa-google-plus
- | Add my Google+ to my portfolio
.spacer
h2.text-center Account Settings
.row
diff --git a/server/views/account/show.jade b/server/views/account/show.jade
index 6496bbda48..df88282365 100644
--- a/server/views/account/show.jade
+++ b/server/views/account/show.jade
@@ -34,10 +34,6 @@ block content
a.fa.fa-github-square.text-primary(title="@#{username}'s GitHub Profile", href=github, target='_blank')
if (linkedin)
a.fa.fa-linkedin-square.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedin, target='_blank')
- if (facebook)
- a.fa.fa-facebook-square.text-primary(title="@#{username}'s Facebook Profile", href='https://facebook.com/' + facebook, target='_blank')
- if (google)
- a.fa.fa-google-plus-square.text-primary(title="@#{username}'s Google Profile", href='https://plus.google.com/' + google, target='_blank')
h1.flat-top.wrappable= name
h1.flat-top.wrappable= location
h1.flat-top.text-primary= "[ " + (progressTimestamps.length) + " ]"
diff --git a/server/views/home.jade b/server/views/home.jade
index d2774b53b1..1d5b517edd 100644
--- a/server/views/home.jade
+++ b/server/views/home.jade
@@ -9,7 +9,7 @@ block content
.big-break
.col-xs-12.col-sm-12.col-md-3
img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_connect.svg', alt='Get great references and connections to start your software engineer career')
- p.large-p Join a community of 200,000+ developers.
+ p.large-p Join a community of 300,000+ developers.
.col-xs-12.col-sm-12.col-md-3
img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_learn.svg', alt='Learn to code and learn full stack JavaScript')
p.large-p Work on coding challenges together.
diff --git a/server/views/resources/about.jade b/server/views/resources/about.jade
index a3dd445de3..e13a74bd15 100644
--- a/server/views/resources/about.jade
+++ b/server/views/resources/about.jade
@@ -9,18 +9,31 @@ block content
span.tag Established:
span.text-primary #{daysRunning}
| days ago
- li
- span.tag Population:
- span.text-primary #{camperCount}
- | campers
- li
- span.tag Completed:
- span.text-primary #{globalCompletedCount}
- | challenges
li.nowrap
span.tag Donated:
span.text-primary $850,000
| in pro-bono code
+ li.nowrap
+ span.tag Pledged:
+ span.text-primary $#{globalPledgedAmount}
+ | to nonprofits
+ .row
+ .col-xs-12.col-sm-10.col-sm-offset-1.col-md-6.col-md-offset-3
+ h2.text-center Certifications
+ hr
+ ul.population-table
+ li.nowrap
+ span.tag Front End:
+ span.text-primary #{frontEndCount}
+ | earned
+ li.nowrap
+ span.tag Data Viz:
+ span.text-primary #{dataVisCount}
+ | earned
+ li.nowrap
+ span.tag Back End:
+ span.text-primary #{backEndCount}
+ | earned
.spacer
.row
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-6.col-md-offset-3
diff --git a/server/views/resources/camper-news-deprecated.jade b/server/views/resources/camper-news-deprecated.jade
new file mode 100644
index 0000000000..22dca20125
--- /dev/null
+++ b/server/views/resources/camper-news-deprecated.jade
@@ -0,0 +1,7 @@
+extends ../layout
+block content
+ h1.text-center We have discontinued Camper News.
+ h2.text-center We are now using our subreddit instead.
+ h3.text-center Here is a
+ a(href='https://www.reddit.com/r/FreeCodeCamp/search?sort=top&q=flair%3AArticle&restrict_sr=on&t=week' target='_blank') Camper News-like way to use our subreddit
+ | .
diff --git a/server/views/resources/shop.jade b/server/views/resources/shop.jade
index 0c5ea6e9da..7529ad0f14 100644
--- a/server/views/resources/shop.jade
+++ b/server/views/resources/shop.jade
@@ -2,6 +2,28 @@ extends ../layout
block content
h1.text-center Shop
hr
+ .row
+ .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center
+ img.img-responsive.img-center(src='//i.imgur.com/GzpUBR5.jpg')
+ h3 Women's fitted black t-shirt
+ h4 Only $19.99!
+ p This high-quality American Apparel t-shirt will help you look like the fantastic developer you are.
+ .spacer
+ a.btn.btn-lg.signup-btn.btn-block(href='//teespring.com/free-code-camp-tshirt-black#pid=70&cid=2343&sid=front' target='_blank') Get this awesome shirt
+ .button-spacer
+ a.btn.btn-primary.btn-lg.btn-block(href='//teespring.com/black-free-code-camp-tshirt-eu#pid=375&cid=100052&sid=front' target='_blank') Get it here if you live in Europe
+ hr
+ .row
+ .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center
+ img.img-responsive.img-center(src='//i.imgur.com/ENPVayN.jpg')
+ h3 Men's black t-shirt
+ h4 Only $19.99!
+ p Features Free Code Camp's classy "function call" logo. You can't have too many awesome black t-shirts!
+ .spacer
+ a.btn.btn-lg.signup-btn.btn-block(href='//teespring.com/free-code-camp-tshirt-black' target='_blank') Get this awesome shirt
+ .button-spacer
+ a.btn.btn-primary.btn-lg.btn-block(href='//teespring.com/black-free-code-camp-tshirt-eu' target='_blank') Get it here if you live in Europe
+ hr
.row
.col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.text-center
img.img-responsive.img-center(src='//i.imgur.com/MH1CvwY.jpg')
@@ -9,9 +31,9 @@ block content
h4 Get two for only $5, with free shipping anywhere!
p These durable 2" (5 cm) stickers sport a matte finish, and look great anywhere - especially on your laptop.
html.
-