Skip to content

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.

How It Works

When you submit a solution, we use eslint to run an automated check on your JavaScript code. The report identifies common issues such as missing semicolons, using var instead of let or const, and other quality concerns.

Standard Reports

Standard reports audit JS and JSX files in your repository. TypeScript and other frameworks are not analyzed by eslint.

AI-Enhanced Reports (Pro)

Pro subscribers receive AI-enhanced analysis that extends beyond eslint:

  • More file types - Analyzes TypeScript (TS/TSX), Vue, Svelte, and Astro files
  • Framework-aware feedback - Detects your framework (React, Vue, Next.js, Nuxt, Angular, Svelte, SvelteKit, Astro) and provides framework-specific guidance
  • Deeper analysis - Identifies logic errors, performance issues, and best practice violations that static analysis tools miss

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, 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:

  1. Errors first - Potential bugs and invalid code
  2. Warnings second - Quality issues worth addressing
  3. Info items - Best practice suggestions

As you develop better habits around code quality, your JavaScript will become more reliable and maintainable.