Skip to content

About

A small JavaScript debugging portfolio project with broken examples, fixed examples, browser demos, tests, and explanations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

JavaScript Bug Fix Lab

A frontend debugging portfolio project showing common JavaScript bugs, corrected versions, tests, and a small browser demo.

This repo is designed to show practical beginner-to-intermediate debugging ability for JavaScript, HTML/CSS, DOM behavior, forms, simple UI logic, and async error handling.

Purpose

The goal of this project is to demonstrate the kind of help many coding clients need:

  • Finding why a button, form, counter, dropdown, or list is not working
  • Explaining the bug in plain language
  • Fixing the code without overcomplicating it
  • Testing edge cases
  • Making the frontend behavior easier to understand

This supports a practical coding-help profile focused on debugging, code review, and small web app prototypes.

Technologies Used

  • JavaScript
  • HTML
  • CSS
  • Node.js
  • Built-in Node assert tests

No external dependencies are required.

Features

This repo includes seven debugging examples:

  1. Button click event handling bug
  2. Form validation bug
  3. Counter type-conversion bug
  4. Dropdown class-name bug
  5. Completed task filtering bug
  6. User list HTML rendering bug
  7. Async fetch error-handling bug

Each example includes:

  • A broken version
  • A fixed version
  • A plain-English explanation
  • Tests for the fixed behavior
  • A small demo page for the UI examples

Folder Structure

javascript-bug-fix-lab/
│
├── css/
│   └── styles.css
├── examples/
│   └── run_examples.js
├── js/
│   ├── broken_examples.js
│   ├── browser_bundle.js
│   ├── dom_demo.js
│   └── fixed_examples.js
├── tests/
│   └── fixed_examples.test.js
├── .gitignore
├── BUG_EXPLANATIONS.md
├── index.html
├── package.json
└── README.md

How to Run the Tests

Make sure Node.js is installed, then run:

npm test

Expected result:

All fixed JavaScript example tests passed.

How to Run the Console Demo

npm run demo

This prints simple before/after-style examples to the terminal.

How to Open the Browser Demo

Open this file in a browser:

index.html

The page includes small demos for:

  • Button click handling
  • Form validation
  • Counter updates
  • Dropdown toggling
  • Completed task filtering

Example

Broken counter-style logic:

return currentValue + 1;

If currentValue comes from the DOM as a string, this can produce:

"5" + 1 = "51"

Fixed logic:

const numericValue = Number(currentValue);
const safeValue = Number.isFinite(numericValue) ? numericValue : 0;
return safeValue + 1;

This produces the expected number:

5 + 1 = 6

What This Demonstrates

This project demonstrates that I can:

  • Debug common JavaScript logic problems
  • Explain why frontend code fails
  • Fix DOM-related behavior clearly
  • Handle edge cases
  • Write simple tests for corrected code
  • Build a small browser demo using HTML, CSS, and JavaScript

The focus is not on advanced frameworks. The focus is practical debugging and clear explanations for real beginner-to-intermediate coding problems.

About

A small JavaScript debugging portfolio project with broken examples, fixed examples, browser demos, tests, and explanations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages