Design comparison
Solution retrospective
If you notice any issues with my project just give me feedback. Especially when it comes to javascript code. Any possibilities to improve it will be nice.
Community feedback
- @GooTaLKPosted over 2 years ago
Dear gumia.
First at all, stop using var to declare variables. Use let or const, let for a variable that you will change at some time, and const when the variable will never change. Those two "rules" works with primitive variables in javascript, they're boolean, number, string, undefined, null, bigint, and symbol. For the others like array, object, map, set, instances, etc. use const, because though they change internally they will never become in other type of variable (e.g. an array will always be an array).
Other thing is the naming of variables. I note you used snake_case, camelCase, UpperCamelCase with no convention behind. A convention of variable naming is a rule set that say you how to write the name of your variables. I recommend you the following:
-
Constants that contain some external info must be written with I_FORGOT_THE_NAME - (e. g. const TABLET_SCREEN_SIZE = 1140). But when I name an object or array I use camelCase.
-
Classes must be written with UpperCamelCase (e. g. class ModalWindow { ... })
-
For other variable I use camelcase
I don't know if exist a name for this convention but it's too recommended (at least for me, you can search more info on google or youtube).
Note: I didn't check the logic of your code but something is not right. Since the calculator does not work as it should.
Marked as helpful0 -
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord