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 trial

JavaScript

RODRIGO MARTINEZ
RODRIGO MARTINEZ
5,912 Points

How 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
Dmitry Polyakov
4,989 Points

Yes, toFixed turns it into a string

RODRIGO MARTINEZ
RODRIGO MARTINEZ
5,912 Points

Thanks for the answer. I know it was kinda silly question. Are there any other methods that act the same way?

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

If 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
RODRIGO MARTINEZ
5,912 Points

Thanks DMitry for quick response. I knew those 2. Thanks again.