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 f5a4a88c82..b1836c1f4d 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 bicyclefunction expression was not used.'); + testString: getUserInput => assert(!getUserInput('index').match(/function/),'Traditional function expression was not used.'); - text: setGear is a declarative function. - testString: assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/), 'setGear is a declarative function.'); + testString: getUserInput => assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/), 'setGear is a declarative function.'); - text: bicycle.setGear(48) changes the gear value to 48. testString: assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.'); @@ -43,7 +43,6 @@ tests: const bicycle = { gear: 2, setGear: function(newGear) { - "use strict"; this.gear = newGear; } }; @@ -54,14 +53,19 @@ console.log(bicycle.gear); - - ## Solution
```js -// solution required +const bicycle = { + gear: 2, + setGear(newGear) { + this.gear = newGear; + } +}; +bicycle.setGear(3); ``` +