fix(curriculum): strip comments from code when testing (#43597)

* fix: update ES6-Compare Scopes of var and let

Fixes Issue: Adding a comment causes a valid answer to be wrong in ES6 > Compare Scopes of the var and let keywords

Fixes: #43578

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md

Co-authored-by: Krzysztof <60067306+gikf@users.noreply.github.com>

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md

Co-authored-by: Krzysztof <60067306+gikf@users.noreply.github.com>

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md

Co-authored-by: Krzysztof <60067306+gikf@users.noreply.github.com>

Co-authored-by: Krzysztof <60067306+gikf@users.noreply.github.com>
This commit is contained in:
prashantaghoshal
2021-09-29 14:43:41 +05:30
committed by GitHub
parent 207a4888c0
commit e4e74aa4f2

View File

@ -85,16 +85,13 @@ This exercise is designed to illustrate the difference between how `var` and `le
`var` should not exist in code.
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert(!code.match(/var/g));
```
The variable `i` declared in the `if` statement should equal the string `block scope`.
```js
(getUserInput) =>
assert(
getUserInput('index').match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)
);
assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g));
```
`checkScope()` should return the string `function scope`