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