บอกเราว่าเกิดอะไรขึ้น:
อธิบายปัญหาของคุณโดยละเอียดที่นี่
**รหัสของคุณ**
class Thermostat{constructor(temp){
this._temp = temp;}
get temperature() {
return 5/9*(this._temp-32);
}
set temperature(desiredTemperature) {
this._temp = desiredTemperature;
}
}
// 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
**ข้อมูลเบราว์เซอร์ของคุณ:**
ตัวแทนผู้ใช้คือ: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15
Challenge: Use getters and setters to Control Access to an Object
ไปสู่ the challenge: