From 3af8a9eb9f52883861842c008347c824cdece51f Mon Sep 17 00:00:00 2001 From: bugron Date: Sat, 5 Sep 2015 15:05:34 +0400 Subject: [PATCH] Fixes typos, word issues in Basic JS, part 3 --- seed/challenges/basic-javascript.json | 68 +++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 242d6334591..b4613140ade 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -719,23 +719,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.", @@ -761,11 +761,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 = {", @@ -815,8 +815,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 = [];", @@ -854,8 +854,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 = [];", @@ -882,13 +882,13 @@ "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;", @@ -1025,8 +1025,8 @@ "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." ], "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() {", @@ -1056,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() {", @@ -1087,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(){", @@ -1302,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", @@ -1460,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", @@ -1625,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",