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

A webApp Calculator using HTML, CSS and javaScript

Dolly-Pee 140

@Dolly-Pee

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


I will really appreciate if someone can help me with how to return a single number when entered in my calculator when no operation is carried out on it after pressing the equal sign button without returning nan

Community feedback

@BeinRain06

Posted

Great Dolly you added regex function in your javascript code, good work, keep going on.

To fix this bug NaN :

Try to add this line code in :

 else if (buttons[I] === equalBtn) {
firstNumber = initialNumber[0];
     //**add**
 if (isNaN(firstNumber)) {

   return counter;// initially counter=0

 }

 counter += firstNumber ;
... 

}

You can go ahead and Try it to see if it's working to put the result to zero.

Have a happy coding Dolly

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