diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.english.md index cea20d2506..239f4882ad 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.english.md @@ -85,10 +85,6 @@ var myStr = "Learning to code is "; ```js -var anAdjective = "awesome!"; -var ourStr = "freeCodeCamp is "; -ourStr += anAdjective; - var someAdjective = "neat"; var myStr = "Learning to code is "; myStr += someAdjective; diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md index adc9a4fca3..cd28541aa6 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md @@ -39,7 +39,7 @@ tests: - text: myStr should have a value of This is the start. This is the end. testString: assert(myStr === "This is the start. This is the end."); - text: You should use the + operator to build myStr. - testString: assert(code.match(/(["']).*(["'])\s*\+\s*(["']).*(["'])/g).length > 1); + testString: assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); - text: myStr should be created using the var keyword. testString: assert(/var\s+myStr/.test(code)); - text: You should assign the result to the myStr variable. @@ -84,7 +84,6 @@ var myStr; // Only change this line ```js -var ourStr = "I come first. " + "I come second."; var myStr = "This is the start. " + "This is the end."; ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.english.md index 52cc0f59ec..0f60f61917 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.english.md @@ -34,7 +34,7 @@ tests: - text: myStr should have a value of This is the first sentence. This is the second sentence. testString: assert(myStr === "This is the first sentence. This is the second sentence."); - text: You should use the += operator to build myStr. - testString: assert(code.match(/\w\s*\+=\s*["']/g).length > 1 && code.match(/\w\s*\=\s*["']/g).length > 1); + testString: assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); ``` @@ -79,9 +79,6 @@ var myStr; ```js -var ourStr = "I come first. "; -ourStr += "I come second."; - var myStr = "This is the first sentence. "; myStr += "This is the second sentence."; ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.english.md index 71efeeeeda..59c860aa5a 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.english.md @@ -34,7 +34,7 @@ Push the odd numbers from 9 through 1 to myArray using a for< ```yml tests: - text: You should be using a for loop for this. - testString: assert(code.match(/for\s*\(/g).length > 1); + testString: assert(/for\s*\([^)]+?\)/.test(code)); - text: You should be using the array method push. testString: assert(code.match(/myArray.push/)); - text: myArray should equal [9,7,5,3,1]. @@ -77,10 +77,6 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();} ```js -var ourArray = []; -for (var i = 10; i > 0; i -= 2) { - ourArray.push(i); -} var myArray = []; for (var i = 9; i > 0; i -= 2) { myArray.push(i); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.english.md index 5d6a83317c..ee01e7fff9 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.english.md @@ -52,7 +52,7 @@ tests: - text: You should delete the property "tails" from myDog. testString: assert(typeof myDog === "object" && myDog.tails === undefined); - text: You should not modify the myDog setup. - testString: 'assert(code.match(/"tails": 1/g).length > 1);' + testString: 'assert(code.match(/"tails": 1/g).length > 0);' ``` @@ -97,13 +97,6 @@ var myDog = { ```js -var ourDog = { - "name": "Camper", - "legs": 4, - "tails": 1, - "friends": ["everything!"], - "bark": "bow-wow" -}; var myDog = { "name": "Happy Coder", "legs": 4, diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md index af7d96da6b..14d5294b00 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md @@ -60,10 +60,6 @@ lastNameLength = lastName; ```js -var firstNameLength = 0; -var firstName = "Ada"; -firstNameLength = firstName.length; - var lastNameLength = 0; var lastName = "Lovelace"; lastNameLength = lastName.length; diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.english.md index 066c395611..f46a9ae2e7 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.english.md @@ -33,7 +33,7 @@ Push the odd numbers from 1 through 9 to myArray using a for< ```yml tests: - text: You should be using a for loop for this. - testString: assert(code.match(/for\s*\(/g).length > 1); + testString: assert(/for\s*\([^)]+?\)/.test(code)); - text: myArray should equal [1,3,5,7,9]. testString: assert.deepEqual(myArray, [1,3,5,7,9]); @@ -74,10 +74,6 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();} ```js -var ourArray = []; -for (var i = 0; i < 10; i += 2) { - ourArray.push(i); -} var myArray = []; for (var i = 1; i < 10; i += 2) { myArray.push(i); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.english.md index 61869081ea..14681be5b5 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.english.md @@ -38,7 +38,7 @@ Use a for loop to work to push the values 1 through 5 onto my ```yml tests: - text: You should be using a for loop for this. - testString: assert(code.match(/for\s*\(/g).length > 1); + testString: assert(/for\s*\([^)]+?\)/.test(code)); - text: myArray should equal [1,2,3,4,5]. testString: assert.deepEqual(myArray, [1,2,3,4,5]); @@ -79,10 +79,6 @@ if (typeof myArray !== "undefined"){(function(){return myArray;})();} ```js -var ourArray = []; -for (var i = 0; i < 5; i++) { - ourArray.push(i); -} var myArray = []; for (var i = 1; i < 6; i++) { myArray.push(i); diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.english.md index 6ab36629d0..a886608a1d 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.english.md @@ -74,9 +74,6 @@ var secondToLastLetterOfLastName = lastName; // Change this line ```js -var firstName = "Ada"; -var thirdToLastLetterOfFirstName = firstName[firstName.length - 3]; - var lastName = "Lovelace"; var secondToLastLetterOfLastName = lastName[lastName.length - 2]; ```