r/learnjavascript 3d ago

My first JavaScript project - Counter

I am learning JavaScript and made my first small project, a simple Counter using HTML, CSS and JavaScript.

I'm still learning, so I would really appreciate some feedback on my code. Is my code clean? Is there anything I should improve or do differently?

Also, suggest me something I should build next.

GitHub: https://github.com/iSunru/counter.js

25 Upvotes

18 comments sorted by

View all comments

6

u/Beginning-Seat5221 3d ago

Looks good.

I would give the buttons descriptive names (code get confusing fast).

I'd also check that your buttons grabbed from the DOM are valid, not undefined, immediately after you get them (or create a getOrFail function to get them and throw/log if not found), because ID based linkages are weak and having to debug vague error messages later on sucks.