diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index 67928f9090..2c1927264a 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -423,7 +423,7 @@
"With JavaScript array
variables, we can store several pieces of data in one place.",
"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."
+ "Refer to the commented code in the text editor if you get stuck."
],
"tests": [
"assert(typeof(myArray) == 'object', 'myArray
should be an array
.');",
@@ -450,7 +450,7 @@
"title": "Nest one Array within Another Array",
"difficulty":"9.98161",
"description":[
- "You can also nest arrays within other arrays, like this: [[\"Bulls\", 43]]
.",
+ "You can also nest arrays within other arrays, like this: [[\"Bulls\", 23]]
.",
"Let's now go create a nested array called myArray
."
],
"tests":[
@@ -720,23 +720,23 @@
"};
",
"",
"Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.",
- "Let's try to make an Object that represents a dog called myDog which contains the properties 'name' (String), 'legs' (Number), 'tails' (Number) and 'friends' (Array)!"
+ "Let's try to make an object that represents a dog called myDog
which contains the properties 'name'
(String), 'legs'
(Number), 'tails'
(Number) and 'friends'
(Array)!"
],
"tests":[
- "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'myDog should contain the property name and it should be a string');",
- "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs !== undefined && typeof(z.legs) === \"number\"){return true;}else{return false;}})(myDog), 'myDog should contain the property legs and it should be a number');",
- "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails !== undefined && typeof(z.tails) === \"number\"){return true;}else{return false;}})(myDog), 'myDog should contain the property tails and it should be a number');",
- "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'myDog should contain the property friends and it should be an array');"
+ "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'myDog
should contain the property name
and it should be a string
.');",
+ "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs !== undefined && typeof(z.legs) === \"number\"){return true;}else{return false;}})(myDog), 'myDog
should contain the property legs
and it should be a number
.');",
+ "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails !== undefined && typeof(z.tails) === \"number\"){return true;}else{return false;}})(myDog), 'myDog
should contain the property tails
and it should be a number
.');",
+ "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'myDog
should contain the property friends
and it should be an array
.');"
],
"challengeSeed":[
- "//var ourDog = {",
+ "// var ourDog = {",
"// \"name\": \"Camper\",",
"// \"legs\": 4,",
"// \"tails\": 1,",
"// \"friends\": [\"everything!\"]",
- "//};",
+ "// };",
"",
- "// add the name(string), legs(number), tails(number) and friends(array) properties to myDog.",
+ "// Add the name (string), legs (number), tails (number) and friends (array) properties to myDog.",
"// You can set them to whatever you want.",
"",
"// Only change code below this line.",
@@ -762,11 +762,11 @@
"myObject.myProperty = \"myValue\";
",
"We can also delete them like this:",
"delete myObject.myProperty;
",
- "Let's add the property \"bark\", and delete the property \"tails\"."
+ "Let's add the property \"bark\"
, and delete the property \"tails\"
."
],
"tests":[
- "assert(myDog.bark !== undefined, 'Add the property \"bark\" to myDog.');",
- "assert(myDog.tails === undefined, 'Delete the property \"tails\" from myDog.');"
+ "assert(myDog.bark !== undefined, 'Add the property \"bark\"
to myDog
.');",
+ "assert(myDog.tails === undefined, 'Delete the property \"tails\"
from myDog
.');"
],
"challengeSeed":[
"// var ourDog = {",
@@ -816,8 +816,8 @@
"Let's try getting a for loop to work by pushing values to an array."
],
"tests":[
- "assert(editor.getValue().match(/for/g), 'You should be using a for loop for this.');",
- "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');"
+ "assert(editor.getValue().match(/for/g), 'You should be using a for
loop for this.');",
+ "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray
should equal [0,1,2,3,4].');"
],
"challengeSeed":[
"ourArray = [];",
@@ -855,8 +855,8 @@
"Let's try getting a while loop to work by pushing values to an array."
],
"tests":[
- "assert(editor.getValue().match(/while/g), 'You should be using a while loop for this.');",
- "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');"
+ "assert(editor.getValue().match(/while/g), 'You should be using a while
loop for this.');",
+ "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray
should equal [0,1,2,3,4].');"
],
"challengeSeed":[
"var myArray = [];",
@@ -883,18 +883,18 @@
"Use Math.random()
to get myFunction
to return a random number."
],
"tests":[
- "assert(typeof(myFunction()) === \"number\", 'myFunction should return a random number');",
- "assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal');",
- "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number');"
+ "assert(typeof(myFunction()) === \"number\", 'myFunction
should return a random number.');",
+ "assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction
should be a decimal.');",
+ "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random
to generate the random decimal number.');"
],
"challengeSeed":[
"function myFunction() {",
- " //Change the 0 to Math.random()",
+ " // Change the 0 to Math.random().",
" // Only change code below this line.",
"",
" return 0;",
"",
- "// Only change code above this line.",
+ " // Only change code above this line.",
"}",
"",
"// We use this function to show you the value of your variable in your output box.",
@@ -944,8 +944,8 @@
"difficulty":"9.9829",
"description":[
"We can use a certain mathematical expression to get a random number between two numbers.",
- "Math.floor(Math.random() * (max - min + 1)) + min
. More info about how it works here.",
- "By using this we can control the output of a random number."
+ "Math.floor(Math.random() * (max - min + 1)) + min
",
+ "By using this, we can control the output of a random number."
],
"tests":[
"assert(myFunction() >= min, 'The random number that\\'s generated by myFunction should be greater than or equal to the minimum number');",
@@ -972,20 +972,19 @@
},
{
"id":"cf1111c1c12feddfaeb3bdef",
- "title": "Use Conditional Logic with If-Else Statements",
+ "title": "Use Conditional Logic with If and Else Statements",
"difficulty":"9.983",
"description":[
- "We can use if statements in JavaScript to only execute code if a certain condition is met.",
- "if statements require some sort of boolean condition to evaluate.",
- "Example:",
+ "We can use if
statements in JavaScript to only execute code if a certain condition is met.",
+ "if
statements require some sort of boolean condition to evaluate.",
+ "For example:",
" if (1 === 2) {
",
" return true;
",
- "}
",
- "else {
",
+ "} else {
",
" return false;
",
"}
",
"Let's use if
and else
statements to make a coin-flip game.",
- "Create an if-else statement
to return heads
if the flip var is zero, or else return tails
if it's not."
+ "Create if
and else
statements to return the string \"heads\"
if the flip variable is zero, or else return the string \"tails\"
if the flip variable is not zero."
],
"tests":[
"assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'myFunction
should either return heads
or tails
.');",
@@ -1022,17 +1021,17 @@
"the
is the pattern we want to match.",
"g
means that we want to search the entire string for this pattern instead of just the first match.",
"i
means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.",
- "Regular expressions
are written by surrounding the pattern with a /
symbol.",
- "Let's try selecting all the occurrences of the word and
in the string George Boole and Alan Turing went to the shop and got some milk
. We can do this by replacing the .
part of our regular expression with the current regular expression
with the word and
."
+ "Regular expressions
are written by surrounding the pattern with /
symbols.",
+ "Let's try selecting all the occurrences of the word and
in the string Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it
. We can do this by replacing the .
part of our regular expression with the current regular expression
with the word and
."
],
"tests":[
- "assert(test==2, 'Your regular expression
should find two occurrences of the word and
');",
- "assert(editor.getValue().match(/\\/and\\/gi/), 'You should have used regular expressions
to find the word and
');"
+ "assert(test==2, 'Your regular expression
should find two occurrences of the word and
.');",
+ "assert(editor.getValue().match(/\\/and\\/gi/), 'You should have used regular expressions
to find the word and
.');"
],
"challengeSeed":[
"var test = (function() {",
- " var testString = \"George Boole and Alan Turing went to the shop and got some milk\";",
- " var expressionToGetMilk = /milk/gi;",
+ " var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";",
+ " var expressionToGetSoftware = /software/gi;",
" // Only change code below this line.",
"",
" var expression = /./gi;",
@@ -1057,8 +1056,8 @@
"Use the \\d
selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers."
],
"tests":[
- "assert(test === 2, 'Your RegEx should have found two numbers in the testString');",
- "assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\\\d+/gi to find the numbers in the testString');"
+ "assert(test === 2, 'Your RegEx should have found two numbers in the testString
.');",
+ "assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\\\d+/gi
to find the numbers in the testString
.');"
],
"challengeSeed":[
"var test = (function() {",
@@ -1088,7 +1087,7 @@
],
"tests":[
"assert(test === 7, 'Your RegEx should have found seven spaces in the testString
.');",
- "assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\\\s+/gi to find the spaces in the testString
.');"
+ "assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\\\s+/gi
to find the spaces in the testString
.');"
],
"challengeSeed":[
"var test = (function(){",
@@ -1303,7 +1302,7 @@
"}
"
],
"tests":[
- "assert((function(){var data = runSlots();if(data === null){return true}else{if(data[0] === data[1] && data[1] === data[2]){return true;}else{return false;}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')"
+ "assert((function(){var data = runSlots();if(data === null){return true}else{if(data[0] === data[1] && data[1] === data[2]){return true;}else{return false;}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null
.')"
],
"challengeSeed":[
"fccss",
@@ -1461,8 +1460,8 @@
"Use the above selector to display each number in its corresponding slot."
],
"tests":[
- "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return true;}else{return false;}})(), 'You should be displaying the result of the slot numbers in the corresponding slots')",
- "assert((editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi) && editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne
, slotTwo
and slotThree
respectively')"
+ "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return true;}else{return false;}})(), 'You should be displaying the result of the slot numbers in the corresponding slots.')",
+ "assert((editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi) && editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne
, slotTwo
and slotThree
respectively.')"
],
"challengeSeed":[
"fccss",
@@ -1626,13 +1625,13 @@
"Set up all three slots like this, then click the \"Go\" button to play the slot machine."
],
"tests":[
- "assert((editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\
\\'\\s*?\\);/gi) && editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\
\\'\\s*?\\);/gi).length >= 3), 'Use the provided code three times. One for each slot')",
- "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[0\\]\\s*?\\)/gi), 'You should have used $('.slot')[0]
at least once')",
- "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[1\\]\\s*?\\)/gi), 'You should have used $('.slot')[1]
at least once')",
- "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[2\\]\\s*?\\)/gi), 'You should have used $('.slot')[2]
at least once')",
- "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once')",
- "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo value at least once')",
- "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once')"
+ "assert((editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\
\\'\\s*?\\);/gi) && editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\
\\'\\s*?\\);/gi).length >= 3), 'Use the provided code three times. One for each slot.')",
+ "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[0\\]\\s*?\\)/gi), 'You should have used $('.slot')[0]
at least once.')",
+ "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[1\\]\\s*?\\)/gi), 'You should have used $('.slot')[1]
at least once.')",
+ "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[2\\]\\s*?\\)/gi), 'You should have used $('.slot')[2]
at least once.')",
+ "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne
value at least once.')",
+ "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo
value at least once.')",
+ "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree
value at least once.')"
],
"challengeSeed":[
"fccss",