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!
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
MUZ140252 Prudence Khupe8,921 Points
failing to extract numbers using the parse
Marcus Parsons15,718 Points
Hey Prudence Khupe,
It wants you to use the variable instead of the actual value because a lot of times those variables will be dynamically generated by some other part of the program. So, instead of putting the value of
boxWidth into parseInt, put the variable name like so:
var boxWidth = "640px"; var boxHeight = "480px"; var numWidth = parseInt(boxWidth, 10);
This way if
boxWidth were to change we would get the value of
boxWidth. I hope that makes sense! :)
Salman AkramCourses Plus Student 40,065 Points
Just swap out the number - "640px" to replace it with variable name boxWidth, we need to extract the number from the boxWidth's variable, not string or number.
var numWidth = parseInt("640px", 10)
Hope that helps.