Help with: Calling the setter with a Celsius value should set the temperature

I do not know how to finish this problem. I do not understand how to fix: Calling the setter with a Celsius value should set the temperature.

  **Your code so far**
// Only change code below this line
class Thermostat{
constructor(temp){
  this._temp = temp;
}

get temperature(){
  return 5/9 * (this._temp -32);
}
set temperature(updateTemp){
  this._temp = updateTemp;
}
}
// 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/103.0.0.0 Safari/537.36

Challenge: Use getters and setters to Control Access to an Object

Link to the challenge:

This accepts a value in Fahrenheit

This accepts a value in Celsius

But you treat the received number in the same, as if they was the same scale. You need to change something here

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.