r/learnjavascript • • 10d ago

What's a sensible DOM-first ordering of JavaScript topics for project-based learning?

I've been teaching myself JavaScript in the mornings before work, alongside Python, and I keep running into the same problem: courses either start with weeks of syntax drills and console.log, or they dump a project on you and quietly assume you already know the DOM, events and modules. I'd like something in between.

What worked for me with Python was building the thing first (a Flask app my board game group uses to log plays and scores) and backfilling the theory when something broke. It stuck far better than any course I'd half-finished. I'd like to replicate that with JavaScript, but I'm unsure what a sensible ordering actually looks like once you go DOM-first.

My rough guess at an order is:

  1. HTML forms and selecting elements with querySelector

  2. Events and updating the page without a full reload

  3. fetch and handling JSON from a small API

  4. async/await and Promise.all once you're fetching several things

  5. Modules and splitting a file up when it gets unwieldy

Does that track, or would you reorder it? A couple of specific questions:

- Is it worth learning array methods like map/filter/reduce before touching fetch, or do they land better once you actually have API data to shape?
- Where should localStorage fit in? I keep seeing beginner projects use it as a fake backend and I can't tell if that teaches good habits or bad ones.
- At what point is it worth jumping from vanilla DOM work to a framework? I don't want to add React to the pile too early and end up knowing neither properly.

For context: I do best with projects that annoy me into existing, like when I got fed up of manually tracking things and wrote a script instead. So if your suggestion is "build X and you'll be forced to learn Y", that's exactly the sort of answer I want. Resources with a project per topic are ideal, but even a topic ordering you'd swear by would help.

0 Upvotes

7 comments sorted by

1

u/CelebrityChess 10d ago

Your order is solid. I'd only swap two things. Learn map and filter before fetch, but only the basics, because fetch returns an array of objects and you'll want to turn it into elements right away, so they stick faster with real data in front of you. Keep reduce for later, it's rarely the thing blocking a beginner. For localStorage, it's fine as a fake backend as long as you treat it as a stepping stone: store JSON with JSON.stringify and JSON.parse, and notice the pain when two tabs disagree or the data grows, since that pain is exactly why servers exist. A nice project for your board game group is a score tracker that saves to localStorage first, then you swap that save function for a fetch call to a tiny API. For frameworks, I'd wait until you've built one app where you manually keep the DOM in sync with your data and felt that get messy. React makes a lot more sense after that.

1

u/baubleglue 10d ago

It sounds like you scared of DOM for some reason. Address it first, if you know HTML, it isn't complicated as you think. It was a nightmare in past, when each browser had its own implementation of DOM engine and different DOM specs. You also can learn JavaScript without DOM - nodejs can be used just like Python's Flask

1

u/chikamakaleyley helpful 10d ago

I would do...

  • selecting elements/DOM traversal

  • Events

  • async/await

  • fetch

  • DOM manipulation

Modules is more or less getting into the realm of organization, but not something u need right now

I changed the order because, this seems like a logical order:

  • find an element

  • add an event listener

  • do something, like make a data request when element is clicked

  • handle the data response

  • use the response to make a change in the DOM

1

u/TheRNGuy 9d ago

What is DOM-first? 

1

u/Discordbothost 9d ago

just means learn by poking the page first (querySelector, click handlers, changing text) instead of weeks of console.log drills. same idea as building a flask app before memorizing every flask decorator.

1

u/Discordbothost 9d ago

your order is basically right. one tweak: slap map/filter in right before fetch so you've got something to do with the json when it lands. localStorage is fine as a fake backend for a board-game score tracker — stringify/parse it, then swap that one save function for a fetch later. frameworks when keeping the DOM in sync by hand starts feeling dumb, not before.

1

u/vibeandco 6d ago

Use your existing Flask app for practice. Add a filter to its list of board-game plays. First, use a small array of sample plays. Keep the array separate from the list on the page. When the filter changes, update the list. This gives map and filter a clear purpose before you use fetch.

Next, load the plays from your server. Show a loading message, an empty result, and an error message when a request fails. Test each case. You can leave localStorage for later, such as saving the selected game in that browser. Your group can then try the feature in an app they already use.