Good Comments Concept
Question
What makes a good code comment?
Hint
If the code is readable, the comment should add context, not duplicate it.
Explanation
A good comment explains WHY the code exists — the reasoning, constraints, or business logic behind it. The code itself shows WHAT it does. Comments like // increment i are useless (the code says i++). Comments like // start from 1 because the API uses 1-based indexing are valuable because they explain the reasoning.
Related Resources
Related Lessons
- Comments and Readability
Learn about comments and code readability.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.