Use getters and setters to Control Access to an Object....<--

Tell us what’s happening:

Your code so far


function makeClass() {
  "use strict";
  /* Alter code below this line */
class Thermostat{
  constructor(Fahrenheit){
    this.Fahrenheit=temperature;
  }
  get Fahrenheit(F){
    return F=C*9.0/5+32;
  }
  set Fahrenheit(F){
    this.F=temperature;
  }
}
  /* 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 6.1; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/

Good try but looks like you are setting values insider your getter when it’s meant to simply return a variable.

You simply want to return this.Fahrentheit in this case.

Also in your setter, you are not actually setting received parameter F to the local variable this.Fahrenheit.