I believe I’ve done this correctly and followed the steps in the hint step by step. Can somebody tell me what I’m doing wrong please?
**Your code so far**
// Only change code below this line
class Thermostat {
constructor(temperature) {
this._temperature = temperature;
}
get temperature() {
return (5/9*(this._temperature-32));
}
set temperature(newTemp) {
_temperature = newTemp*9/5+32;
}
}
// Only change code above this line
const thermos = new Thermostat(76); // Setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in Celsius
thermos.temperature = 26;
temp = thermos.temperature; // 26 in Celsius
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36
Challenge: Use getters and setters to Control Access to an Object
Am I misinterpreting what’s being asked for? The constructor takes a temperature parameter in Fahrenheit and sets the private variable to the same temperature. The getter returns the temperature converted to celcius. The setter takes a temperature in Celcius and sets the private variable to the that temperature converted to Fahrenheit. Is this not what’s being asked for?