r/javascript • u/raj_chandra3 • Apr 07 '20
AskJS [AskJS] Tried writing code in vanilla js but can someone suggest a correct file system, what I did is not satisfying to me
The above link takes you to a color game which I had created ila few years ago, the idea is to select the color that will be formed when three colors RED, GREEN and BLUE are mixed in certain percentage. It was made with basic html, css and js website hosted in GitHub itself.
Recently, I was super bored doing react and angular and due to lockdown I had plenty of time. So I decided to rewrite everything from scratch using ES6 and adding a few features like login for my friends so that we can store our past gameplays, also a leaderboard to keep track of who is doing better.
To my surprise, a small project like this is super easy to make without any frameworks and I enjoyed Coding something where I understood everything and there wasn't any magic happening 🤩
It took me almost 4 days(3hr/day) to complete the project. The current implementation is much more better than previous one, the codebase is readable, modular and neat. I have also worked on the UI to make is more user friendly by using flat colors.
If anyone is into front-end development I love to hear your feedback on this app.
Repo link: Github
If you like the repo, do let me know by 🌟 ing it 🤓
Note: you don't have to login, that's for my friends only ✨
0
3
u/SaaSWriters Apr 08 '20
Interesting game, it would be nice if the color remained after you get it. That way you can look at it again and analyze it.
Why are you using arrow functions? You're not using
thisanywhere in your code - arrow functions don't help here.. If you named your functions, your code would be easier to read. Plus, it would be easier to debug as well.Overall, it would be better if your code was easier to read. You can still organize it so that it's more explicit what each part is doing. Right now, it seems like you're more focused on making your code concise.
I will admit that concise code impresses many developers. But it's excruciating to maintain and extend. In the long term, it adds to development time and it more bugs get introduced.
Since this is a small project, this may not be obvious. For bigger projects, this is one of the things that make JavaScript hard to work with.
Let it be clear what your code is doing.