Intermediate Code Comments #inline-comments #todo #fixme

Writing Inline Comments

6 exercises — practise the WHY not WHAT rule, choosing the right marker (TODO/FIXME/HACK), and writing comments that give future developers the context they need.

0 / 6 completed
Inline comment rules
  • WHY not WHAT: explain intent, constraint, business rule — not what the code does
  • TODO: planned work not yet done
  • FIXME: known bug — name the bug, the condition, and suggest a fix
  • HACK: temporary workaround — state why and when to remove
  • SECURITY: explain the risk and the consequence of changing this code
  • Magic numbers: always explain the value and its source
  • No noise: never write a comment that just restates the code
1 / 6
You have this line of code:

results = results.filter(x => x.status !== "deleted")

Which comment follows the "WHY not WHAT" rule?