What if I put calculation to celsius in constructor?
It’s passes the tests so… is it really acceptable?
// Only change code below this line
class Thermostat{
constructor(temp){
this._temp=5/9 * (temp - 32);
}
get temperature(){
//console.log(5/9 * (this._temp - 32))
return this._temp
}
set temperature(newTemp){
return this._temp = newTemp
console.log(newTemp)
}
}
// 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