Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Learn how to convert a string to a number in JavaScript, using parseFloat(), parseInt(), and the unary plus (+) operator.
Resources
Example parseInt()
and parseFloat()
Return Values
Parse Method | Return Value |
---|---|
parseInt('11') | 11 |
parseInt('135px') | 135 |
parseInt('202.99') | 202 |
parseInt('Plan 9') | NaN |
parseFloat('32.50') | 32.50 |
parseFloat('-273.15°') | -273.15 |
parseFloat('Absolute zero is -273.15') | NaN |
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Ryan M
16,785 PointsAny reason why Number() was not mentioned? Seems to function almost exactly the same as unary plus + operator
Posted by Ryan MRyan M
16,785 Points3 Answers
-
Elfar Oliver
3,924 PointsI used an entirely different method and got it to work
Posted by Elfar OliverElfar Oliver
3,924 Points1 Answer
-
karan Badhwar
Web Development Techdegree Graduate 18,135 Points1 Answer
-
Victor Stanciu
Full Stack JavaScript Techdegree Student 11,196 Points1 Answer
-
ja5on
10,338 Points2 Answers
-
Kylie Soderblom
3,890 Points1 Answer
-
ja5on
10,338 Points2 Answers
-
Farid Lavizadeh
12,006 Points4 Answers
-
Agnieszka Spychała
1,675 Points1 Answer
-
Rupert Travers
4,652 Points4 Answers
-
Jennifer Ciaccio
UX Design Techdegree Student 11,137 Points2 Answers
-
Paul May
3,432 Points2 Answers
-
Tracy Lyon
4,007 Points3 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up