I passed a challenge with the 'wrong' answer... (Use getters and setters to Control Access to an Object)

Hi :slight_smile:

I’m wondering why FCC passed my answer.

I only hit the “run test” button to check for errors thus far, but the big green tick appears…

This was all I did:

  /* Alter code below this line */
  class Thermostat {
    constructor(temperature) {
      this.temperature = temperature;
  /* Alter code above this line */

I’m quite sure the challenge wanted me to use the get and set methods (which I totally do not understand yet). Could it be that this is an error on FCC, or is the above answer actually an equivalent to the solution with the get and set methods?

You are correct. The issue is that the test functions check only three conditions:

  • Thermostat should be a class with a defined constructor method.
  • class keyword was used.
  • Thermostat can be instantiated.

Which doesn’t match the lesson instructions. There is an open issue about it on the FCC GitHub

1 Like

Ahh I see… Good to know (ironically).

Sorry I didn’t think of checking FCC GitHub issues first ^^;

1 Like

No worries. I had to be told about it, too.