The JavaScript Report
The JavaScript Report analyzes your code for quality, potential bugs, and adherence to best practices. Well-written JavaScript is easier to debug, maintain, and extend. The goal of this report is to help you level up as a developer by identifying areas for improvement. Use the feedback to practice refining and improving your code—this iterative process is how real growth happens.
The JavaScript Report checks your code for quality, likely bugs, and common best practices. Well-written JavaScript is easier to debug, maintain, and extend. Use these findings to tighten up your code as you build.
How it works
When you submit a solution, we use eslint to run an automated check on your JavaScript. The report flags common issues such as missing semicolons, using var instead of let or const, and other quality concerns.
This check covers JS and JSX files. TypeScript and framework-specific files (like Vue or Svelte) aren't covered by eslint here.
Going deeper with the AI code review
These automated checks catch concrete, rule-based issues. For feedback that detects your framework and looks at logic, architecture, and best practices across your whole solution, the AI code review scores your code across several dimensions, including Best Practices and Architecture. It also covers more file types, including TypeScript, Vue, Svelte, and Astro. Pro members get it on every submission, and free members get one a month. See The AI Code Review to learn more.
Common issues detected
Using var instead of let/const
var can lead to unexpected behavior due to hoisting.
Instead of:
var name = 'John';
var items = [];
Use:
const name = 'John';
let items = [];
Use const for values that won't be reassigned, and let for values that will.
Unused variables
Variables declared but never used add clutter.
Instead of:
function calculateTotal(items) {
const taxRate = 0.08;
const discount = 0.1; // Never used
return items.reduce((sum, item) => sum + item.price, 0) * (1 + taxRate);
}
Use:
function calculateTotal(items) {
const taxRate = 0.08;
return items.reduce((sum, item) => sum + item.price, 0) * (1 + taxRate);
}
Console statements left in code
Debug statements should be removed before submission.
Instead of:
function handleSubmit(data) {
console.log('Form data:', data);
submitToServer(data);
}
Use:
function handleSubmit(data) {
submitToServer(data);
}
Using == instead of ===
Loose equality can lead to unexpected comparisons.
Instead of:
if (value == null) { }
if (count == 0) { }
Use:
if (value === null || value === undefined) { }
if (count === 0) { }
Missing error handling
Code that can fail should handle errors gracefully.
Instead of:
async function fetchData(id) {
const response = await fetch(`/api/data/${id}`);
return response.json();
}
Use:
async function fetchData(id) {
try {
const response = await fetch(`/api/data/${id}`);
if (!response.ok) {
throw new Error(`HTTP error: ${response.status}`);
}
return response.json();
} catch (error) {
console.error('Failed to fetch data:', error);
throw error;
}
}
Quick reference
| Issue | Solution |
| --- | --- |
| var usage | Use let or const |
| == comparison | Use === for strict equality |
| Unused variables | Remove them |
| Console statements | Remove before submitting |
| Missing error handling | Add try/catch for async operations |
Acting on your report
Review your JavaScript Report findings and prioritize:
- Errors first: potential bugs and invalid code.
- Warnings second: quality issues worth addressing.
- Info items: best-practice suggestions.
As you build better habits around code quality, your JavaScript gets more reliable and maintainable.