Tell us what’s happening:
i got this error : " Calling the setter with a Celsius value should set the temperature"
i don’t understand it, and the value when using the getter and the setter look fine !? pls help thanks
**Your code so far**
// Only change code below this line
class Thermostat {
// constructor
constructor(tempF) {
this._temperature=tempF; }
// getter
get temperature() {
let cTemp=((5/9)*(this._temperature-32));
return cTemp;
}
set temperature(t) {
let cTemp=t*(9.0/5)+32;
this._temperature = cTemp;
}
}
// Only change code above this line
const thermos = new Thermostat(76); // Setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in Celsius
console.log(temp);
thermos.temperature = 26;
temp = thermos.temperature; // 26 in Celsius
console.log(temp);
thermos.temperature=98;
temp=thermos.temperature
console.log(temp);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
Challenge: Use getters and setters to Control Access to an Object
Link to the challenge: