From e4e74aa4f26caf281de2c6a2e0e3ad1deccc0beb Mon Sep 17 00:00:00 2001 From: prashantaghoshal <83444996+prashantaghoshal@users.noreply.github.com> Date: Wed, 29 Sep 2021 14:43:41 +0530 Subject: [PATCH] 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> --- .../es6/compare-scopes-of-the-var-and-let-keywords.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 4250078f7e..4c52f3c6c8 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -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`