Skip to content
  • Unlock Pro
  • Log in with GitHub
Profile
OverviewSolutions
7
Comments
1
Sandra
@sandrj1

All comments

  • Krish•660
    @Alone-07
    Submitted over 3 years ago

    Tip calculator app challenge hub using Flexbox and Grid

    1
    Sandra•120
    @sandrj1
    Posted over 3 years ago

    Hello! 👋 Everything looks nice! I would only suggest two things:

    • You could use <input type="number"> instead of <input type="text"> so the user won't be able to type strings and you would avoid displaying "$NaN" as your result.
    • When the number of people is 0, I would add a control so that your output will never show "$Infinity".

    For example, you could add this to your code:

    If (peopleValue > 0) {

     tipAmount.innerText = totaltip;
    
     personAmount.innerText = person;
    

    }

    Hope this helps! You did a really good job :)

Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub