Challenge - 5 Problems
Deno Doc Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateWhat does
deno doc output for a simple exported function?Given this Deno module code, what will
deno doc display for the exported function greet?Deno
/** Greets a user by name */ export function greet(name: string): string { return `Hello, ${name}!`; }
Attempts:
2 left
💡 Hint
Think about how documentation tools use comments above exported items.
✗ Incorrect
deno doc extracts the function signature and the JSDoc comment above it to generate documentation.
📝 Syntax
intermediateWhich command correctly generates documentation for a file named
mod.ts?You want to generate documentation for
mod.ts using Deno. Which command is correct?Attempts:
2 left
💡 Hint
The
doc command is a direct subcommand of deno.✗ Incorrect
The correct syntax to generate documentation is deno doc filename.
🔧 Debug
advancedWhy does
deno doc not show documentation for a private function?Consider this code snippet:
function helper() { return 42; }
export function main() { return helper(); }
Why does deno doc only show documentation for main and not helper?Attempts:
2 left
💡 Hint
Think about what
export means for visibility.✗ Incorrect
deno doc documents only exported (public) symbols by default.
🧠 Conceptual
advancedWhat is the effect of using
--json flag with deno doc?When you run
deno doc --json mod.ts, what is the output format?Attempts:
2 left
💡 Hint
Think about machine-readable formats.
✗ Incorrect
The --json flag outputs documentation in JSON format for tools to consume.
❓ state_output
expertWhat is the number of documented items shown by
deno doc for this module?Given this module code:
/** Adds two numbers */
export function add(a: number, b: number): number {
return a + b;
}
/** Multiplies two numbers */
export function multiply(a: number, b: number): number {
return a * b;
}
function subtract(a: number, b: number): number {
return a - b;
}
How many items will deno doc show in the documentation output?Attempts:
2 left
💡 Hint
Remember which functions are exported.
✗ Incorrect
deno doc shows only exported functions: add and multiply.
