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 JavaScript Foundations Numbers Parsing Numbers From Strings

Robert Manolis
STAFF
Robert Manolis
Treehouse Guest Teacher

I am totally stuck here. This makes no sense. I did what the video showed, but it doesn't work. HELP!

var numWidth = parseInt("640", 10);

What is wrong with this answer. I don't get it.

2 Answers

Use the boxWidth variable in your expression rather than putting in the value directly:

var numWidth = parseInt(boxWidth, 10);
Robert Manolis
Robert Manolis
Treehouse Guest Teacher

Thank you so much, Miss Kitty. I almost had that, but I put the boxWidth in quotes. This Java Script might just drive me bananas.

Hello, Robert Manolis:

You didn't actually pass in the variable holding the value of "640px", you passed an unscoped primary value of 640

Passing in 640 is entirely different than passing in the variable described in the challenge to the first parameter of parseInt.