fix(curriculum): getUserInput is not defined

This commit is contained in:
Valeriy
2019-02-13 22:11:56 +03:00
committed by Stuart Taylor
parent f4e264e49d
commit 99cf6090bd

View File

@ -23,9 +23,9 @@ Refactor the function <code>setGear</code> inside the object <code>bicycle</code
```yml
tests:
- text: Traditional function expression was not used.
testString: assert(!getUserInput('index').match(/function/),'Traditional <code>function</code> expression was not used.');
testString: getUserInput => assert(!getUserInput('index').match(/function/),'Traditional <code>function</code> expression was not used.');
- text: <code>setGear</code> is a declarative function.
testString: assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/), '<code>setGear</code> is a declarative function.');
testString: getUserInput => assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/), '<code>setGear</code> is a declarative function.');
- text: <code>bicycle.setGear(48)</code> changes the <code>gear</code> value to 48.
testString: assert((new bicycle.setGear(48)).gear === 48, '<code>bicycle.setGear(48)</code> changes the <code>gear</code> 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);
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
const bicycle = {
gear: 2,
setGear(newGear) {
this.gear = newGear;
}
};
bicycle.setGear(3);
```
</section>