Submitted over 1 year ago
I made this using html css and javaScript. I used grid and flex.
@Arfat789
Design comparison
SolutionDesign
Solution retrospective
It was easy. The javascript code i need to know, How can I make that more clean.
Community feedback
- @yefreescodingPosted over 1 year ago
You did a great job. The design looks almost identical to the original, and the calculator works as expected. To answer your question, "How can I make that more clean?", I'll give you a couple of tips:
- A good practice when it comes to name JavaScript Variables is to use camelCase.
const main_num = document-getElementById('main_text'); // instead you should name them like this: const mainNum = document-getElementById('main_text');
- Another good tip to use more descriptive words when naming function. Example:
// You have this two functions. One is for add the values that the user inputs when clicks on a button...: function addNum(number){ //Code goes here } // And this one is for "evaluate", or calculate the final result. function addNums(number){ //Code goes here }
- See, there are too similar. A better way to name this functions will be something like this:
function addUserValue(number){ //Code goes here } // Something like this: function calcUserValues(number){ //Code goes here }
These are just a couple of tips to make your code more semantic, and structured. There are a bunch of amazing resources online on how to make your JavaScript code cleaner.
Either way you're doing an amazing job!! Keep it up!!
Marked as helpful0@Arfat789Posted over 1 year ago@yefreescoding Thanks you very much. Your guideness was really helpful for me.
0
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