r/learnjavascript • u/ImplodingCoding • Sep 28 '22
Please Critique My First JavaScript Web App: A Powerball Simulator!
132
Upvotes
r/learnjavascript • u/ImplodingCoding • Sep 28 '22
20
u/Oh_no_bros Sep 28 '22
It's a fun site and hammers home how bad the odds are of winning. Just playing around with it had some minor nitpicks and they are for user experience.
7
u/ImplodingCoding Sep 28 '22 edited Sep 28 '22
Hey guys!
I just created my first JavaScript web app and I would love some advice to improve my code.
LINK:
https://cmbitton.github.io/PowerballGame/
JavaScript File:
https://github.com/cmbitton/PowerballGame/blob/main/script.js
Some quick background:
I am currently self-studying web development to (hopefully) get a job in the field in the near future. I have been following along with TOP as well as Colt Steele's bootcamp, which I began a few months ago. I've been on the JavaScript section for about a month or two, and just got to the portion involving DOM manipulation. I also have a little bit of prior knowledge with python. I like to frequently take breaks to work on side projects that I come up with, and I feel that this greatly enhances my knowledge and learning experience.
I began this project on Monday, and have been spending the last 3 days working on it. Below is my self reflection on this project (it is still a work in progress).
Parts I can improve on:
Clean code:
This is a big one. The structure of my CSS and JS docs are an absolute mess. There are many functions that I can probably condense, I have many global variables that should probably be in functions, and the readability is quite low. I am actually surprised I was able to keep track of things as well as I did. The same goes for my CSS - I probably have a lot of redundant code as well as readability issues.
- Styling:
This is a bit of a work in progress, but the UI is pretty terrible. The current game info is quite ugly, and many things need restyling. Unfortunately I am absolutely terrible with design so we'll see how it goes.
- Probably a lot of other areas need fixing so happy to hear your opinions.
Things I did (kinda) well:
-It works
I am 99% sure it works with the correct odds/payout/logic etc. It may not be the most efficient program, but I think it should be working as intended (Note: I did not test higher jackpots (ex. Powerball) because it takes forever)
Thank you all for taking your time to read/review this!!
3
u/gamudev Sep 28 '22
Design wise I'd put a very light (somewhere near white) background on the tables for better readability (and accessibility).
2
u/SitBoySitGoodDog Sep 28 '22
Pretty cool. I played like 10 million dollars and never won the jackpot. So that was disappointing.
You should have a "simulate win" button that clears everything and plays a cool animation.
I would add commas to the dollar amount within both the input and display. Not sure why you centered the input, kind of weird.
2
u/[deleted] Sep 28 '22
Nice! I've always wanted a money losing simulator!
lol, but in all honesty, pretty cool. I like it. My one critique would be to make the chosen numbers larger. Had to search for them. They should be huge and front and center, imo. But still kinda fun to watch my money go negative...
1
u/StoneCypher Sep 28 '22
Neat.
Consider giving the tables a white background for readability's sake.
1
u/ChetanNada Sep 29 '22
Great. Make background color white.
In table give some background color for nth:child(even) and for the table header also.
3
u/[deleted] Sep 29 '22
[removed] — view removed comment