Change:
Hello FreeCodeCamp team, I found a minor typo in the JavaScript learning module. In the lesson titled "Use getters and setters to Control Access to an Object," there is a small error in the instruction related to creating a getter and setter for temperature conversion. Here's the specific portion of the instruction that needs correction: Incorrect Line: "In the class, create a getter to obtain the temperature in Celsius and a setter to set the temperature in Celsius." Suggested Correction: "In the class, create a getter to obtain the temperature in Celsius and a setter to set the temperature in Fahrenheit." This correction is necessary to maintain clarity and accuracy in the learning material. The correct units (Celsius and Fahrenheit) should align with the given problem statement and the intended outcome of the exercise. Thank you for your attention to detail and dedication to improving the learning experience on FreeCodeCamp. Navigate to the javascript algorithms and data structures learning module. Go to ES6 course. Locate the lesson titled "Use getters and setters to Control Access to an Object." Read the relevant portion of the instruction mentioned. To correct the mentioned typo and ensure clarity in the instruction, the line should be modified as follows: Original: "In the class, create a getter to obtain the temperature in Celsius and a setter to set the temperature in Celsius." Suggested Correction: "In the class, create a getter to obtain the temperature in Celsius and a setter to set the temperature in Fahrenheit." This change aligns with the problem statement and maintains consistency with the intended temperature units. !
I'm not sure I see the problem here. How do we know that the intent is for the setter to set the temp in Fahrenheit? Maybe I'm missing something. The seed code seems to indicate that it should be set in Celsius:
no, in the last line It also runs the getter function, which means that it takes Celsius as Fahrenheit and tries to convert it into Celsius that's why we have to set the temperature in Fahrenheit. Here is the working code. `
Ya, I'm not seeing a problem here either. The getter spits out a Celsius temp and the setter takes a Celsius temp. How you actually store the temp internally in the class is not a consideration here. You don't have to store the internal temp in Fahrenheit. You can solve this by storing the temp internally in Celsius:
Yes, I agree with you, we can solve this by storing temp internally. "The constructor accepts a Fahrenheit temperature. In the class, create a getter to obtain the temperature in Celsius and a setter to set the temperature in Celsius." I could be wrong but the above lines clearly mention that we have to use the getter function to get the temperature in Celsius and the constructor has to accept temperature in Fahrenheit. I feel that these lines are a bit confusing.
I guess I can see how it could be confusing - but I don't think your suggestion here is the way to go. It's setting the temp in Celsius: So saying that the setter function should set the temp in Fahrenheit doesn't seem to make sense to me. What about or something.
Yes, we have to make this line more clear so students won't get confused.
This line makes a requirement to use temperature as a parameter for the constructor and also the name of the getter and setter function to be temperature. So, for better user understanding we can user this line: like this: . So that final code becomes like this:
Also the assert functions also requires temperature to be set
and standard says the getter and setter function should have the same name as the property with _ removed for which property the getter and setter are working
I think In the class, create a to obtain the temperature in Celsius and a that accepts a temperature in Celsius. is the way to go. We do not need to specify the parameter name of the constructor.
Yes I agree with you. Knowing what to put in the parameter in the constructor looking will be a task that requires good understanding for the students.
I the first timer label. The We want to change it to the suggestion: If you would like to contribute, and have not read the contributors docs, please do so here:
I have raised a PR for this change . This is my first ever PR on an open-source project.

Discussion:
Use the `class` keyword to create a `Thermostat` class. The `constructor` accepts a Fahrenheit temperature. <del> In the class, create a `getter` to obtain the temperature in Celsius and a `setter` to set the temperature in Celsius. </del> <ins> In the class, create a `getter` to obtain the temperature in Celsius and a `setter` that accepts a temperature in Celsius. </ins> Remember that `C = 5/9 * (F - 32)` and `F = C * 9.0 / 5 + 32`, where `F` is the value of temperature in Fahrenheit, and `C` is the value of the same temperature in Celsius.