fix: Update test for ES6 challenge (#34300)
* fix: es6 challenge test * delete console.log
This commit is contained in:
@ -38,7 +38,7 @@ tests:
|
|||||||
- text: <code>class</code> keyword was used.
|
- text: <code>class</code> keyword was used.
|
||||||
testString: getUserInput => assert(getUserInput('index').match(/class/g),'<code>class</code> keyword was used.');
|
testString: getUserInput => assert(getUserInput('index').match(/class/g),'<code>class</code> keyword was used.');
|
||||||
- text: <code>Thermostat</code> can be instantiated.
|
- text: <code>Thermostat</code> can be instantiated.
|
||||||
testString: assert(() => {const t = new Thermostat(32); return typeof t === 'object' && t.temperature === 0;}, '<code>Thermostat</code> can be instantiated.');
|
testString: assert((() => {const t = new Thermostat(32);return typeof t === 'object' && t.temperature === 0;})(), '<code>Thermostat</code> can be instantiated.');
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -75,17 +75,17 @@ temp = thermos.temperature; // 26 in C
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
function makeClass() {
|
function makeClass() {
|
||||||
"use strict";
|
'use strict';
|
||||||
/* Alter code below this line */
|
/* Alter code below this line */
|
||||||
class Thermostat {
|
class Thermostat {
|
||||||
constructor(fahrenheit) {
|
constructor(temperature) {
|
||||||
this._tempInCelsius = 5/9 * (fahrenheit - 32);
|
this._temperature = (5 / 9) * (temperature - 32);
|
||||||
}
|
}
|
||||||
get tempInCelsius(){
|
get temperature() {
|
||||||
return _tempInCelsius;
|
return this._temperature;
|
||||||
}
|
}
|
||||||
set tempInCelsius(newTemp){
|
set temperature(temperature) {
|
||||||
this._tempInCelsius = newTemp;
|
this._temperature = temperature;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Alter code above this line */
|
/* Alter code above this line */
|
||||||
|
Reference in New Issue
Block a user