From 43778e5149717f25e84c4e716261d95d6d00753f Mon Sep 17 00:00:00 2001 From: bugron <bugron@mail.ru> Date: Sat, 5 Sep 2015 14:00:30 +0400 Subject: [PATCH] Fixes typos, word issues in Basic JS, part 2 --- 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 242d633459..669f804330 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -421,17 +421,17 @@ "difficulty": "9.9816", "description": [ "With JavaScript <code>array</code> 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: <code>var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]</code>.", + "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: <code>var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]</code>.", "Now let's create a new array called <code>myArray</code> that contains both a <code>string</code> and a <code>number</code> (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', '<code>myArray</code> should be an <code>array</code>.');", + "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first item in <code>myArray</code> should be a <code>string</code>.');", + "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in <code>myArray</code> should be a <code>number</code>.');" ], "challengeSeed": [ - "//var array = [\"John\", 23];", + "// var array = [\"John\", 23];", "", "// Only change code below this line.", "", @@ -484,11 +484,11 @@ "Create a variable called <code>myData</code> and set it to equal the first value of <code>myArray</code>." ], "tests":[ - "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'The variable <code>myData</code> 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 <code>myData</code> should equal the first value of <code>myArray</code>.');" ], "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 <code>myArray</code> 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;}})(), '<code>myArray</code> 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 <code>myArray</code>.');" ], "challengeSeed":[ "var ourArray = [1,2,3];", @@ -541,18 +541,18 @@ "Another way to change the data in an array is with the <code>.pop()</code> function.", "<code>.pop()</code>is used to \"pop\" a value off of the end of an array. We can retrieve this value by performing <code>pop()</code> in a variable declaration.", "Any type of variable can be \"popped\" off of an array.", - "Use the <code>.pop()</code> function to remove the last item from myArray." + "Use the <code>.pop()</code> function to remove the last item from <code>myArray</code>." ], "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), '<code>myArray</code> 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), '<code>removed</code> 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 <code>pop()</code> data off of the end of an array, you can also <code>push()</code> data onto the end of an array.", - "Take the myArray array and <code>push()</code> this value to the end of it: <code>[\"dog\", 3]</code>." + "Take the <code>myArray</code> array and <code>push()</code> this value to the end of it: <code>[\"dog\", 3]</code>." ], "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), '<code>myArray</code> 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": [ "<code>pop()</code> always removes the last element of an array. What if you want to remove the first? That's where <code>.shift()</code> comes in.", - "Take the myArray array and <code>shift()</code> the first value off of it. Set <code>myRemoved</code> to the first value of <code>myArray</code> using <code>shift()</code>." + "Take the <code>myArray</code> array and <code>shift()</code> the first value off of it. Set <code>myRemoved</code> to the first value of <code>myArray</code> using <code>shift()</code>." ], "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), '<code>myArray</code> 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), '<code>myRemoved</code> should contain <code>\"John\"</code>.');" ], "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 <code>shift</code>things from the start of the array, we need to learn how to <code>unshift</code>stuff back to the start", - "Let's take the code we had last time and <code>unshift</code>this value to the start: <code>\"Paul\" </code>" + "Now that we've learned how to <code>shift</code>things from the start of the array, we need to learn how to <code>unshift</code>stuff back to the start.", + "Let's take the code we had last time and <code>unshift</code>this value to the start: <code>\"Paul\"</code>." ], "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), '<code>myArray</code> should now have [\"Paul\", 23, [\"dog\", 3]]).');" @@ -644,12 +644,12 @@ "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", "ourArray.shift();", "ourArray.unshift([\"happy\", \"joy\"]);", - "// ourArray now equals [[\"happy\", \"joy\"], \"J\", [\"cat\"]]", + "// ourArray now equals [[\"happy\", \"joy\"], \"J\", [\"cat\"]].", "", "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.", "", "", @@ -672,10 +672,10 @@ "<code>  return a + b;</code>", "<code>}</code>", "We can \"call\" our function like this: <code>functionName();</code>, and it will run and return its <code>return</code> value to us.", - "Create and call a function called <code>myFunction</code> that returns the sum of a and b." + "Create and call a function called <code>myFunction</code> that returns the sum of <code>a</code> and <code>b</code>." ], "tests":[ - "assert((function(){if(typeof(f) !== \"undefined\" && typeof(f) === \"number\" && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return true;}else{return false;}})(), 'Your function should return the value of a + b');" + "assert((function(){if(typeof(f) !== \"undefined\" && typeof(f) === \"number\" && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return true;}else{return false;}})(), 'Your function should return the value of <code>a + b</code>.');" ], "challengeSeed":[ "var a = 4;", @@ -685,7 +685,7 @@ " return a - b;", "};", "", - "// Don't modify above this line", + "// Don't modify above this line.", "// Create a function called myFunction that returns the value of a plus b.", "// Only change code below this line.", "",