Tell us what’s happening:
Tests are giving me the OK even though I have not set neither the getter or setter part of the exercise. By just defining the class and constructor alone the challenge is completed. Maybe add 2 more tests to make sure getter and setter are used?
Your code so far
function makeClass() {
"use strict";
/* Alter code below this line */
class Thermostat {
constructor() {
// see? no setter nor getter here... hmm
}
}
/* Alter code above this line */
return Thermostat;
}
const Thermostat = makeClass();
const thermos = new Thermostat(76); // setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in C
thermos.temperature = 26;
temp = thermos.temperature; // 26 in C
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/