
Design comparison
Solution retrospective
any help with rewriting the code to make it look good, also the tip and total amount before selecting the tip are visible as $NaN, how can I make it to display as $0.00?
Community feedback
- @erntTt94Posted 4 months ago
Hello, good job! I can't understand your code very well, but why you add styles through JS instead of CSS.. ? I think your NaN is coming from the function Number.. i tried to understand your code, but istead of using Number just get the value and if its a string you can convert it with parseInt or parseFloat or maybe NaN coming from here:
tipAmount.textContent = "$" + Number(tip/peopleValue).toFixed(2)
instead of + you can use templete literals - `$ ${tip/peopleValue).toFixed(2)How this is somehow connected to React? Its Vanilla JS, i don't understand React, but for React you need to have different components and a main component which is App.jsx/js..
0
Please log in to post a comment
Log in with GitHubJoin 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