[WHY?!] ES6: Use getters and setters to Control Access to an Object

So I was doing this exercise and I got a pass with the code below. but then I saw that a needed to also calculate some equations I did not include in my code.

so… why is it that I got a pass without including the equations to convert Fahrenheit into Celsius and vice versa?

function makeClass() {
  "use strict";
  /* Alter code below this line */
class Thermostat {
    this.fahrneheit = fahrneheit;
  get thermos(){
    return this.thermos;
  set thermos(t){
    this.thermos = t;
  /* 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

You are correct: the tests are not at all comprehensive for this. In theory you should need to write code that matches the instructions, but the tests, as you can see, allow you to pass by doing not very much (afaik you can pass with even less code than that). There are fixes, it’s just taking time to get them into the live version I’m afraid.


oh. =[ Thanks for the feedback.

1 Like