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 trialMatt James
1,948 PointsparseInt not working what am i doing wrong?
var boxWidth = "640px"; var boxHeight = "480px";
var numWidth = parseInt("boxWidth" "10");
3 Answers
Richard Duncan
5,568 PointsYou have " wrapping your variable name, so parseInt is literally being called on a string with the value of "boxWidth" rather than the variable boxwidth that contains the string value "640px".
Also, you need a comma separating your arguments e.g.
parseInt(boxWidth, 10);
Matt James
1,948 PointsOK Thanks that worked
Richard Duncan
5,568 PointsFancy marking it as correct so that it might help someone in the future? :)
Matt James
1,948 PointsDone thanks a lot Richard.
Richard Duncan
5,568 PointsNo probs man glad I could help.