Sitemap

My First Project Failed. Here’s What I Learned About JavaScript That Tutorials Don’t Teach You
Failure Analysis

3 min readJan 3, 2026

--

My first real JavaScript project wasn’t ambitious. It wasn’t fancy. It was a simple app meant to handle user input, update the UI, and save a bit of state. On paper, it was beginner-friendly. In reality, it broke in ways I didn’t know how to fix — at first.

This is what actually went wrong, and why that failure taught me more than any tutorial ever did.

What I Tried to Build

I tried to build a basic to-do list app:

  • Add tasks
  • Delete tasks
  • Mark tasks as completed
  • Persist data in the browser

I had already watched tutorials. I understood the idea of how it should work. So I assumed the building part would be easy.

It wasn’t.

Where It Went Wrong

The app worked… sometimes.

  • Buttons stopped responding after a few clicks
  • Tasks duplicated randomly
  • Deleting one item removed the wrong one
  • Page refresh wiped everything

The worst part? There were no clear errors — just broken behavior.

Here’s a simplified version of one of the problems:

buttons.forEach(button => {
button.addEventListener("click", () => {
tasks.splice(index, 1);
renderTasks();
});
});

It looked right.
But it wasn’t.

The Concepts I Misunderstood

1. Scope and Closures

I didn’t understand that the index I relied on wasn’t stable. When the UI re-rendered, the reference changed. The button still existed—but the data it pointed to didn’t.

Tutorials show what works, not why it breaks.

2. DOM ≠ Data

I treated the DOM like it was the source of truth.

Get Jerico Desalla’s stories in your inbox

Join Medium for free to get updates from this writer.

It’s not.

My data lived in JavaScript, but I kept manipulating the UI directly instead of updating the data first and re-rendering from state. That mismatch caused chaos.

3. Event Listeners Multiply

Every re-render added new event listeners without removing old ones.
One click triggered multiple handlers.

That’s why things duplicated.

No tutorial warned me about that.

How I Fixed It

I stopped patching and rewrote the logic properly.

  • I created a single source of truth (an array of tasks)
  • I used unique IDs instead of array indexes
  • I attached event listeners once
  • I re-rendered the UI from state, not guesses

Example fix:

function renderTasks() {
list.innerHTML = "";tasks.forEach(task => {
const item = document.createElement("li");
item.textContent = task.title;
item.addEventListener("click", () => {
deleteTask(task.id);
});
list.appendChild(item);
});
}

Simple. Predictable. Stable.

What This Failure Taught Me (That Tutorials Don’t)

  1. If you don’t understand why code works, it will break later
  2. JavaScript problems are often logic problems, not syntax
  3. Rebuilding is sometimes faster than debugging
  4. Bugs are not setbacks — they’re explanations
  5. Projects teach what tutorials skip

For Other Beginners

If your project feels messy, that’s normal.
If it breaks, you’re learning.
If you’re frustrated, you’re doing real development.

Tutorials teach you how to start.
Projects teach you how to think.

Fail early. Fail honestly. Then fix it properly.

Here is the Github Repo of the To-Do-App:

Jericoding/To-Do-App: A beginner-friendly To-Do app built while learning JavaScript, featuring lessons on scope, DOM manipulation, event handling, and state management. A real project that taught me more than tutorials ever could.

--

--

Jerico Desalla
Jerico Desalla

Written by Jerico Desalla

0 followers

"guide who's still on the path"