Getters and Setters OK Solution?

Tell us what’s happening:

Hey guys! So I actually got this to work, but I wanted to better understand it so I went to the Hint answer code and they gave me the code below:

class Thermostat {
constructor(fahrenheit) {
this.fahrenheit = fahrenheit;
}

get temperature() {
return (5 / 9) * (this.fahrenheit - 32);
}

set temperature(celsius) {
this.fahrenheit = (celsius * 9.0) / 5 + 32;
}
}

The code I used to make it work is below… Is there any benefit to using the code they gave me instead of the code I came up with? Thanks!

  **Your code so far**

// Only change code below this line
class Thermostat {
constructor(fahrenheit) {
  this._celcius = 5/9 * (fahrenheit - 32);
}
get temperature() {
  return this._celcius;
}
set temperature(newTemp) {
  this._celcius = newTemp; 
}
}
// Only change code above this line

const thermos = new Thermostat(76); // Setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in Celsius
thermos.temperature = 26;
temp = thermos.temperature; // 26 in Celsius
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36.

Challenge: Use getters and setters to Control Access to an Object

Link to the challenge:

Nope. Your solution and the solution provided by FCC both do the same thing, they just store the value passed into the constructor differently.