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 305ea24fd4..146062cc1d 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1989,48 +1989,35 @@ "
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 "
+ "Add a local variable to myFunction
to override the value of outerWear
with \"sweater\"
."
],
"releasedOn": "11/27/2015",
"tests": [
- "assert(1===1, 'message: message here');"
+ "assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear
');",
+ "assert(myFunction() === \"sweater\", 'message: myFunction
should return \"sweater\"
');",
+ "assert(/return outerWear/.test(editor.getValue()), 'message: Do not change the return statement');"
],
"challengeSeed": [
+ "// Setup",
+ "var outerWear = \"T-Shirt\";",
+ "",
+ "function myFunction() {",
+ " // Only change code below this line",
"",
"",
- ""
+ "",
+ " // Only change code above this line",
+ " return outerWear;",
+ "}",
+ "",
+ "myFunction();"
],
"solutions": [
- ""
- ],
- "type": "waypoint",
- "challengeType": "1",
- "nameCn": "",
- "nameFr": "",
- "nameRu": "",
- "nameEs": "",
- "namePt": ""
- },
- {
- "id": "56533eb9ac21ba0edf2244c1",
- "title": "Context for Functions",
- "description": [
- "Show how each instance of a function has its own values/context"
- ],
- "releasedOn": "11/27/2015",
- "tests": [
- "assert(1===1, 'message: message here');"
- ],
- "challengeSeed": [
- "",
- "",
- ""
- ],
- "tail": [
- ""
- ],
- "solutions": [
- ""
+ "var outerWear = \"T-Shirt\";",
+ "function myFunction() {",
+ " var outerWear = \"sweater\";",
+ " return outerWear;",
+ "}"
],
"type": "waypoint",
"challengeType": "1",
@@ -2092,77 +2079,23 @@
"Assume we have pre-defined a function sum
which adds two numbers together, then: ",
"var ourSum = sum(5, 12);
",
"will call sum
, which returns a value of 17
and assigns it to ourSum
.",
- "Instructions
"
+ "Instructions
",
+ "Call process
with an argument of 7
and assign it's return valueto the variable processed
."
],
"releasedOn": "11/27/2015",
"tests": [
- "assert(1===1, 'message: message here');"
+ "assert(processed === 2, 'message: processed
should have a value of 10
');",
+ "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(editor.getValue()), 'message: You should assign process
to processed
');"
],
"challengeSeed": [
"// Setup",
+ "var processed = 0;",
+ "",
"function process(num) {",
" return (num + 3) / 5;",
"}",
"",
"// Only change code below this line",
- "var processed = 0; // Change this line",
- ""
- ],
- "tail": [
- ""
- ],
- "solutions": [
- ""
- ],
- "type": "waypoint",
- "challengeType": "1",
- "nameCn": "",
- "nameFr": "",
- "nameRu": "",
- "nameEs": "",
- "namePt": ""
- },
- {
- "id": "56533eb9ac21ba0edf2244c4",
- "title": "Return Early Pattern for Functions",
- "description": [
- "Explain how to use return early for functions"
- ],
- "releasedOn": "11/27/2015",
- "tests": [
- "assert(1===1, 'message: message here');"
- ],
- "challengeSeed": [
- "",
- "",
- ""
- ],
- "tail": [
- ""
- ],
- "solutions": [
- ""
- ],
- "type": "waypoint",
- "challengeType": "1",
- "nameCn": "",
- "nameFr": "",
- "nameRu": "",
- "nameEs": "",
- "namePt": ""
- },
- {
- "id": "56533eb9ac21ba0edf2244c5",
- "title": "Optional Arguments for Functions",
- "description": [
- ""
- ],
- "releasedOn": "11/27/2015",
- "tests": [
- "assert(1===1, 'message: message here');"
- ],
- "challengeSeed": [
- "",
"",
""
],
@@ -2759,7 +2692,7 @@
"nameEs": "",
"namePt": ""
},
- {
+ {
"id": "5664820f61c48e80c9fa476c",
"title": "Golf Code",
"description": [
@@ -3279,6 +3212,93 @@
"nameEs": "",
"namePt": ""
},
+ {
+ "id": "5679ceb97cbaa8c51670a16b",
+ "title": "Returning Boolean Values from Functions",
+ "description": [
+ "Explain how to return booleans vs. if/else "
+ ],
+ "releasedOn": "11/27/2015",
+ "tests": [
+ "assert(1===1, 'message: message here');"
+ ],
+ "challengeSeed": [
+ "",
+ "",
+ ""
+ ],
+ "tail": [
+ ""
+ ],
+ "solutions": [
+ ""
+ ],
+ "type": "waypoint",
+ "challengeType": "1",
+ "nameCn": "",
+ "nameFr": "",
+ "nameRu": "",
+ "nameEs": "",
+ "namePt": ""
+ },
+ {
+ "id": "56533eb9ac21ba0edf2244c4",
+ "title": "Return Early Pattern for Functions",
+ "description": [
+ "Explain how to use return early for functions"
+ ],
+ "releasedOn": "11/27/2015",
+ "tests": [
+ "assert(1===1, 'message: message here');"
+ ],
+ "challengeSeed": [
+ "",
+ "",
+ ""
+ ],
+ "tail": [
+ ""
+ ],
+ "solutions": [
+ ""
+ ],
+ "type": "waypoint",
+ "challengeType": "1",
+ "nameCn": "",
+ "nameFr": "",
+ "nameRu": "",
+ "nameEs": "",
+ "namePt": ""
+ },
+ {
+ "id": "56533eb9ac21ba0edf2244c5",
+ "title": "Optional Arguments for Functions",
+ "description": [
+ ""
+ ],
+ "releasedOn": "11/27/2015",
+ "tests": [
+ "assert(1===1, 'message: message here');"
+ ],
+ "challengeSeed": [
+ "",
+ "",
+ ""
+ ],
+ "tail": [
+ ""
+ ],
+ "solutions": [
+ ""
+ ],
+ "type": "waypoint",
+ "challengeType": "1",
+ "nameCn": "",
+ "nameFr": "",
+ "nameRu": "",
+ "nameEs": "",
+ "namePt": ""
+ },
{
"id": "565bbe00e9cc8ac0725390f4",
"title": "Counting Cards",
@@ -4092,7 +4112,7 @@
"ourArray
will now contain [0,2,4,6,8]
.",
"Let's change our initialization
so we can count by odd numbers.",
"Instructions
",
-"Push the odd numbers from 1 through 9 to myArray
using a for
loop."
+ "Push the odd numbers from 1 through 9 to myArray
using a for
loop."
],
"tests": [
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for
loop for this.');",
@@ -4130,7 +4150,7 @@
"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.",
"Instructions
",
-"Push the odd numbers from 9 through 1 to myArray
using a for
loop."
+ "Push the odd numbers from 9 through 1 to myArray
using a for
loop."
],
"tests": [
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for
loop for this.');",