diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.english.md index 7dd26b6914..7f8777d73e 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.english.md @@ -11,7 +11,7 @@ forumTopicId: 18216 A common task in JavaScript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console: ```js -var arr = [10,9,8,7,6]; +var arr = [10, 9, 8, 7, 6]; for (var i = 0; i < arr.length; i++) { console.log(arr[i]); } @@ -36,8 +36,8 @@ tests: testString: assert(total === 20); - text: You should use a for loop to iterate through myArr. testString: assert(code.match(/for\s*\(/g).length > 1 && code.match(/myArr\s*\[/)); - - text: You should not set total to 20 directly. - testString: assert(!code.match(/total[\s\+\-]*=\s*(0(?!\s*[;,]?$)|[1-9])/gm)); + - text: You should not attempt to directly assign the value 20 to total. + testString: assert(!code.replace(/\s/g, '').match(/total[=+-]0*[1-9]+/gm)); ```