Tip Calculator

Tip Calculator - student project

Thank you Kalob for making such an easy-to-follow course! I've tried to learn Javascript in the past but I was always overwhelmed and unmotivated. Your course pushes me at a good place and has me thinking about all the cool things Javascript will bring to my front-end toolkit. With this project, I was inspired to make a tip calculator that could round to the nearest dollar and also split checks.

Overall I'm quite happy with how it turned out. However, I have two pending things on my mind:

1) I have a lot of repetitive code (I know, I didn't follow the DRY principle!) in this example and spent a long time trying to figure out how to condense it, but failed.

2) I didn't know the best way to add a message that says "please enter a number" if a user left the bill field blank, or entered text instead of a number. Could I use === or null/undefined to capture these edge cases?

Feedback and suggestions are welcome! I know I have a long way to go but I'm really excited to be in this course and I look forward to learning more. Thanks!

The link to my pen can be found below, or at: https://codepen.io/Liangy/pen/LYVZXjb

Ying Liang

A student of the world!