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
Eliezer Hutton6,207 Points
Stuck on a Parsing Numbers challenge
I don't really know what i'm doing wrong here, and would appreciate any input: The challenge is to create a new variable named "numWidth" and use the "parseInt" method to extract the numeric value from boxWidth's string value. The given code is: var boxWidth = "640px"; var boxHeight = "480px";
and i have input: var numWidth = parseInt("640px", 10);
and received this error message: Bummer! Sorry! That's not correct. A correct answer will use the form: var numVariable = parseInt(stringVariable, radix);
I really can't see where i've gone wrong here, unless i've misunderstood the wording of the question, any help is appreciated
You're doing everything okay as far as the syntax goes, but you're missing the point of the task. You should be passing the
boxWidth variable to the
parseInt function, not a string literal.