Why is my tip calculator not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why is my tip calculator not working?

I am trying to make a tip calculator for practice. The user should enter in their bill amount and the tip percentage they want to tip and it should tell you the amount to tip. I am not sure what i am doing wrong with my javascript. Could anyone help me understand? https://code.sololearn.com/WHP5eqGTrolT/?ref=app

21st Apr 2019, 3:17 PM
Ryan Lusby
Ryan Lusby - avatar
2 Answers
+ 4
I dont know to much of js. But i believe in line 10 you have x = totalTip.toFixed(2) Should be x = x.toFixed(2)
21st Apr 2019, 3:35 PM
Anya
Anya - avatar
+ 2
That helped! Thank you! Its functioning now and I can keep working
21st Apr 2019, 4:56 PM
Ryan Lusby
Ryan Lusby - avatar