From 7d7a1127a7ea1dbe5dbb5f836902b7ba6430983b Mon Sep 17 00:00:00 2001 From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Date: Tue, 30 Apr 2019 17:26:07 -0700 Subject: [PATCH] fix: remove comments before tests (#35906) --- ...oncise-declarative-functions-with-es6.english.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.english.md index da55e26ff6..da5cb738b1 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.english.md @@ -23,9 +23,9 @@ Refactor the function setGear inside the object bicycle assert(!getUserInput('index').match(/function/)); + testString: getUserInput => assert(!removeJSComments(code).match(/function/)); - text: setGear should be a declarative function. - testString: getUserInput => assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/)); + testString: assert(typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/)); - text: bicycle.setGear(48) should change the gear value to 48. testString: assert((new bicycle.setGear(48)).gear === 48); @@ -53,6 +53,15 @@ console.log(bicycle.gear); +### After Test +
+ +```js +const removeJSComments = str => str.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, ''); +``` + +
+ ## Solution