Responsive keypad using grid, theme change using variable in css
Design comparison
Solution retrospective
Making the keypad clickable was somewhat stressful, would love an easier way to do that. Also I would the calculator screen to clear off after each calculation I need help with that.
Please I would love to know the easiest way to create the calculator.
Community feedback
- @mukwende2000Posted over 1 year ago
First of all never use var to declare variables, use either const or let e.g
const number = 5 let letter = 'a'
This is the recommended way and that is what everyone does
secondly make sure all your functions have descriptive names, instead of del, give it something like deleteNum(since delete is a keyword) and clear instead of cls
Never do
<button onclick="funct()"></button>
put all the code to do with event listeners in the javascript file,
To make the code work this way, you can use the same approach you used to do the theme switching
const btns = document.querySelectorAll('button') btns.forEach(btn => { btn.addEventListener('click', handleClick) })
You can then add the login for making the text on the button appear on the screen
how do you make it better,
i will encourage you to look at solutions from other members and learn something from how they approached, i did this challenge as, you can check mine if you want. But its just the beginning continue practicing and make sure you getting better everyday and learning new things. Good luck.
Marked as helpful0@PearlPerfectPosted over 1 year ago@mukwende2000 Really helpful. Thank you, I will try to implement it.
1 - @DamsithcoderPosted over 1 year ago
Hi . great work . It might looks better if you follow above things. body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; } .fullCalculator { height: auto; } and keep coding .
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