Welcome to the Treehouse Community
Looking to learn something new?
My Solution- it works but its not perfect
So i completed my solution before watching the video. It answers all the questions from the assignment. However, it's not the same. Curious as to how i can fix it or make smaller? Seems like it could also be longer than needed but not sure how to maybe shrink it? Thanks in advance!
Steven Parker216,096 Points
The instructions say to convert the inputs "from a string to a floating point number", but this code converts to an integer instead. So instead of "parseInt" you could use "parseFloat". This will allow it to handle inputs like "2.5".
You could do the conversions just once and store the numbers in variables, then you would not need to keep converting over and over for each calcualtion. This would be an application of the "DRY" principle (Don't Repeat Yourself).
Good first try, and with these two fixes it should be pretty close to perfect.