Describe your suggestion
Under the section "Naming function and variables", the guideline suggests that const isSelected = true; is bad practice because it starts with "is", which goes against the recommendation that "variables should always begin with a noun or an adjective". I believe this might be a misconception. In fact, for boolean variables, it's actually a common and good practice in the JavaScript community to prefix with is, has, or can.
// ✅ Prefix with: is, has, can
let isPerson = true;
let hasAge = true;
let canDance = true;
These prefixes make it clear that the variable represents a boolean value, thereby enhancing the readability of the code. This convention is widely accepted and recommended in various coding standards and guidelines.
For instance, a variable like isSelected clearly indicates that it holds a boolean value, representing whether something "is selected" or not. This makes the code more understandable to the reader.
Here are some references that support this convention:
I believe an update to this guideline in your curriculum would be beneficial for learners, especially beginners who are trying to grasp good coding practices. Thank you for considering my suggestion.
Path
Foundations
Lesson Url
https://www.theodinproject.com/lessons/foundations-clean-code
Checks
(Optional) Discord Name
developer007
(Optional) Additional Comments
No response
Describe your suggestion
Under the section "Naming function and variables", the guideline suggests that
const isSelected = true;is bad practice because it starts with "is", which goes against the recommendation that "variables should always begin with a noun or an adjective". I believe this might be a misconception. In fact, for boolean variables, it's actually a common and good practice in the JavaScript community to prefix withis,has, orcan.These prefixes make it clear that the variable represents a boolean value, thereby enhancing the readability of the code. This convention is widely accepted and recommended in various coding standards and guidelines.
For instance, a variable like
isSelectedclearly indicates that it holds a boolean value, representing whether something "is selected" or not. This makes the code more understandable to the reader.Here are some references that support this convention:
I believe an update to this guideline in your curriculum would be beneficial for learners, especially beginners who are trying to grasp good coding practices. Thank you for considering my suggestion.
Path
Foundations
Lesson Url
https://www.theodinproject.com/lessons/foundations-clean-code
Checks
(Optional) Discord Name
developer007
(Optional) Additional Comments
No response