Skip to content
Permalink
Browse files

fix: make tests more robust (#37830)

  • Loading branch information
RandellDawson authored and Manish-Giri committed Dec 2, 2019
1 parent a68e3ef commit dd2fb28ee069005c2d7229a9026ee0905c0988d6
@@ -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 <code>for</code> loop. This code will output each element of the array <code>arr</code> 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 <code>for</code> loop to iterate through <code>myArr</code>.
testString: assert(code.match(/for\s*\(/g).length > 1 && code.match(/myArr\s*\[/));
- text: You should not set <code>total</code> 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 <code>total</code>.
testString: assert(!code.replace(/\s/g, '').match(/total[=+-]0*[1-9]+/gm));
```

</section>

0 comments on commit dd2fb28

Please sign in to comment.
You can’t perform that action at this time.