Tell us what’s happening:
I cannot run this code in compiler. The Compiler doesn’t run it and I cannot know the reason
Your code so far
function makeClass() {
"use strict";
/* Alter code below this line */
class Thermostat{
constructor(farenheit){
this._farenheit = farenheit;
}
get temperature(C){
return C * 9.0 / 5 + 32;
}
set temperature(f){
this._farenheit = f;
}
}
/* 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 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/