Ambiguous Challenge Instructions
See original GitHub issueChallenge Make Object Properties Private has an issue.
Please describe how to reproduce this issue, and include links to screenshots if possible.
Over the past couple days I’ve noticed a GH issue (#12385) and a few questions in the Javascript chat room about this challenge, all of which have all had to do with confusion about the purpose of the getGear and setGear functions. The challenge instructions explain private variables and private methods well, but doesn’t explain the purpose of getters and setters.
I think adding a simple explanation of getters and setters without going too deep into encapsulation would benefit campers greatly. The new instructions would include something along these lines:
Getter functions such as
getSpeed()are meant to simply return (get) the value of an object’s private variable to the user without the user directly accessing the private variable.Setter functions such as
accelerate(change)are meant to modify (set) the value of an object’s private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely.
If people have other opinions on the current instructions or proposed changes, please share 😄
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)

Top Related StackOverflow Question
Since the challenge asks you to define
getGearandsetGearI think the explanation would be welcome. Yes it is a paradigm, but it is a pretty standard one.I’m 👍 for a change to the instructions
@robbawebba sure thing, follow the issues on the https://github.com/FreeCodeCamp/CurriculumExpansion repo and join the conversation in the Contributors Chat room.