My First JavaScript Project: What I Learned
Hi DEV community! π
I just finished my first real JavaScript project - a restaurant
ordering app. It works, but looking back at my code, I realize
I made a lot of beginner mistakes.
The Project
[Screenshot yoki GIF qo'ying]
Simple ordering interface where you can:
- Browse menu items
- Add to cart
- See order total
- Complete payment
π GitHub: https://github.com/semizemes/Jimmy-s-Diner
What I Think I Did Wrong
1. Too Many Global Variables
I declared like 10+ variables at the top for DOM elements...
2. Repetitive Code
My displayOrder() function literally copies the same logic
three times for pizza, hamburger, and beer.
3. Hard-coded Everything
Item IDs are 0, 1, 2 everywhere in the code. If I add a new
item, I'd have to change code in multiple places.
Questions for the Community
- How would you refactor this?
- What patterns should I learn for this type of app?
- Any resources you'd recommend?
I'm eager to learn! Drop your suggestions below π
Top comments (1)
Hi, very welcome to DEV Community! π
Great job on finishing your first JavaScript project, thatβs a huge milestone.
Your write-up is clear and honest, and itβs always awesome to see beginners share what they learned along the way.
Keep experimenting, keep building, and keep posting your progress.
The community loves seeing projects like this. π