diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index 5e2738d840..67928f9090 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -421,17 +421,17 @@
"difficulty": "9.9816",
"description": [
"With JavaScript array
variables, we can store several pieces of data in one place.",
- "You start an array declaration with an opening bracket, end it with a closing bracket, and put a comma between each entry, like this: var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]
.",
+ "You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]
.",
"Now let's create a new array called myArray
that contains both a string
and a number
(in that order).",
"Refer to the comments if you get stuck."
],
"tests": [
- "assert(typeof(myArray) == 'object', 'myArray should be an array');",
- "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first item in myArray should be a string');",
- "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');"
+ "assert(typeof(myArray) == 'object', 'myArray
should be an array
.');",
+ "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first item in myArray
should be a string
.');",
+ "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray
should be a number
.');"
],
"challengeSeed": [
- "//var array = [\"John\", 23];",
+ "// var array = [\"John\", 23];",
"",
"// Only change code below this line.",
"",
@@ -484,11 +484,11 @@
"Create a variable called myData
and set it to equal the first value of myArray
."
],
"tests":[
- "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'The variable myData
should equal the first value of myArray');"
+ "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'The variable myData
should equal the first value of myArray
.');"
],
"challengeSeed":[
- "//var ourArray = [1,2,3];",
- "//var ourData = ourArray[0]; // equals 1",
+ "// var ourArray = [1,2,3];",
+ "// var ourData = ourArray[0]; // equals 1",
"",
"var myArray = [1,2,3];",
"// Only change code below this line.",
@@ -514,8 +514,8 @@
"Now modify the data stored at index 0 of myArray
to the value of 3."
],
"tests":[
- "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'myArray should now be [3,2,3]');",
- "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'You should be using correct index to modify the value in myArray');"
+ "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'myArray
should now be [3,2,3].');",
+ "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'You should be using correct index to modify the value in myArray
.');"
],
"challengeSeed":[
"var ourArray = [1,2,3];",
@@ -541,18 +541,18 @@
"Another way to change the data in an array is with the .pop()
function.",
".pop()
is used to \"pop\" a value off of the end of an array. We can retrieve this value by performing pop()
in a variable declaration.",
"Any type of variable can be \"popped\" off of an array.",
- "Use the .pop()
function to remove the last item from myArray."
+ "Use the .pop()
function to remove the last item from myArray
."
],
"tests": [
- "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');",
- "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removed), 'myArray should only have the first two values left([\"cat\"], 2)');"
+ "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray
should only have the first two values left([\"John\", 23]).');",
+ "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removed), 'removed
should only have the first two values left([\"cat\"], 2).');"
],
"challengeSeed": [
- "//var numbers = [1,2,3];",
- "//console.log(numbers); // logs [1,2,3]",
- "//var removed = numbers.pop();",
- "//console.log(numbers); // logs [1,2]",
- "//console.log(removed); // logs 3",
+ "// var numbers = [1,2,3];",
+ "// console.log(numbers); // logs [1,2,3]",
+ "// var removed = numbers.pop();",
+ "// console.log(numbers); // logs [1,2]",
+ "// console.log(removed); // logs 3",
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"// Only change code below this line.",
@@ -573,20 +573,20 @@
"difficulty": "9.9818",
"description": [
"Not only can you pop()
data off of the end of an array, you can also push()
data onto the end of an array.",
- "Take the myArray array and push()
this value to the end of it: [\"dog\", 3]
."
+ "Take the myArray
array and push()
this value to the end of it: [\"dog\", 3]
."
],
"tests": [
- "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');"
+ "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'myArray
should only have the first two values left([\"John\", 23, [\"dog\", 3]]).');"
],
"challengeSeed": [
"var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];",
"ourArray.pop();",
"ourArray.push([\"happy\", \"joy\"]);",
- "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]]",
+ "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]].",
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"myArray.pop();",
- "//Add a [\"dog\", 3] to the end of myArray using push()",
+ "// Add a [\"dog\", 3] to the end of myArray using push().",
"// Only change code below this line.",
"",
"",
@@ -604,21 +604,21 @@
"difficulty": "9.9817",
"description": [
"pop()
always removes the last element of an array. What if you want to remove the first? That's where .shift()
comes in.",
- "Take the myArray array and shift()
the first value off of it. Set myRemoved
to the first value of myArray
using shift()
."
+ "Take the myArray
array and shift()
the first value off of it. Set myRemoved
to the first value of myArray
using shift()
."
],
"tests": [
- "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray should only have the last two values left([23, [\"dog\", 3]])');",
- "assert((function(d){if(d === 'John' && typeof(myRemoved) === 'string'){return true;}else{return false;}})(myRemoved), 'myRemoved should contain \"John\"');"
+ "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray
should only have the last two values left([23, [\"dog\", 3]]).');",
+ "assert((function(d){if(d === 'John' && typeof(myRemoved) === 'string'){return true;}else{return false;}})(myRemoved), 'myRemoved
should contain \"John\"
.');"
],
"challengeSeed": [
"var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];",
"ourRemoved = ourArray.shift();",
- "// ourArray now equals [\"J\", [\"cat\"]]",
+ "// ourArray now equals [\"J\", [\"cat\"]].",
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"// Only change code below this line.",
"",
- "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
+ "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]].",
"",
"// Only change code above this line.",
"",
@@ -634,8 +634,8 @@
"title": "Manipulate Arrays With unshift()",
"difficulty": "9.9818",
"description": [
- "Now that we've learned how to shift
things from the start of the array, we need to learn how to unshift
stuff back to the start",
- "Let's take the code we had last time and unshift
this value to the start: \"Paul\"
"
+ "Now that we've learned how to shift
things from the start of the array, we need to learn how to unshift
stuff back to the start.",
+ "Let's take the code we had last time and unshift
this value to the start: \"Paul\"
."
],
"tests": [
"assert((function(d){if(typeof(d[0]) === \"string\" && d[0].toLowerCase() == 'paul' && d[1] == 23 && d[2][0] != undefined && d[2][0] == 'dog' && d[2][1] != undefined && d[2][1] == 3){return true;}else{return false;}})(myArray), 'myArray
should now have [\"Paul\", 23, [\"dog\", 3]]).');"
@@ -643,13 +643,13 @@
"challengeSeed": [
"var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];",
"ourArray.shift();",
- "ourArray.unshift(\"happy\");",
"// ourArray now equals [\"happy\", \"J\", [\"cat\"]]",
+ "ourArray.unshift(\"happy\");",
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"myArray.shift();",
"",
- "// Add \"Paul\" to the start of myArray",
+ "// Add \"Paul\" to the start of myArray.",
"// Only change code below this line.",
"",
"",