Script Valley
Writing Clean Code: Naming, Functions & Structure
Comments and Documentation Done Right/Assessment

Practice & Assessment

Test your understanding of Comments and Documentation Done Right

Multiple Choice Questions

6
1

Which of these is an example of a comment that should be written?

2

What is 'comment rot'?

3

What is the main job of a project README?

4

A TODO comment is most useful when it includes:

5

What does a commit message body (as opposed to the subject line) explain?

6

Which functions should have JSDoc or docstring documentation?

Coding Challenges

1
1

Comment Audit and JSDoc Addition

You are given a JavaScript utility library (utils.js) containing 15 functions with a mix of noise comments, missing documentation on public functions, 8 undescribed TODO comments, and 2 outdated comments that contradict the current code. Input: the provided utils.js file. Output: cleaned-utils.js where all noise comments are deleted, all public functions have proper JSDoc with @param, @returns, and any edge case notes, all TODOs are updated to include owner placeholder, ticket placeholder, and action description, and all outdated comments are corrected or removed. Estimated time: 25 minutes.

Easy

Mini Project

1

Documentation Kit for an Undocumented API

You are given a REST API with 12 endpoints across 3 resources (users, products, orders) that has zero documentation. Your task: write a complete README.md with one-line project description, quick start commands, and full environment variable table; add JSDoc to every exported function in the codebase; write conventional commit messages for 5 example changes as a COMMIT_EXAMPLES.md file; convert all 11 existing TODO comments to the owner-ticket-action-urgency format with a placeholder for each field; and write a COMMENTS_GUIDE.md explaining to future contributors when to comment and when to rely on code clarity. No application logic changes.

Medium