Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive keypad using grid, theme change using variable in css

@PearlPerfect

Desktop design screenshot for the Calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

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

Mukwende 1,370

@mukwende2000

Posted

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 helpful

0

@PearlPerfect

Posted

@mukwende2000 Really helpful. Thank you, I will try to implement it.

1
K.Damsith 330

@Damsithcoder

Posted

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

@PearlPerfect

Posted

@Damsithcoder Thank you. I will try it out

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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