Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRODRIGO MARTINEZ
5,912 PointsHow did the numbers turned into strings? Doest the .toFixed method converts them?
I thought .toFixed just worked on changing the number's decimals amount.
2 Answers
Dmitry Polyakov
4,989 PointsYes, toFixed turns it into a string
Dmitry Polyakov
4,989 PointsIf you have an input where a user types in some text, all the value of this input is a string.
Say, you ask a client "How old are you?" and the client should type in his age (for example, 33), it's going to be a string, not a number. To convert it to a number you need to use parseInt() or parseFloat()
RODRIGO MARTINEZ
5,912 PointsThanks DMitry for quick response. I knew those 2. Thanks again.
RODRIGO MARTINEZ
5,912 PointsRODRIGO MARTINEZ
5,912 PointsThanks for the answer. I know it was kinda silly question. Are there any other methods that act the same way?