Tell us what’s happening:
I input some lines of code but I’m not really sure why my answer was correct. In fact, I feel like it’s not correct as it doesn’t utilize some of the information from the actual description. I suppose it might fit the user cases given.
Can anyone give any insight into this issue?
Your code so far
function makeClass() {
"use strict";
/* Alter code below this line */
class Thermostat {
constructor(num) {
this._num = num;
}
get temp() {
return this._num;
}
set temp(updatedTemp) {
this._num = updatedTemp;
}
}
/* Alter code above this line */
return Thermostat;
}
const Thermostat = makeClass();
const thermos = new Thermostat(76); // setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in C
thermos.temperature = 26;
temp = thermos.temperature; // 26 in C
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object