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 trialsperera
4,017 PointsSolution to Numbers and Strings challenge
Hi, what is the solution to the Numbers and Strings challenge. I have tried the following, but get a syntax error Paser error:
var totalWidth = parseInt(width) x numOfDivs;
2 Answers
anthony amaro
8,686 Pointshello sperera your syntax is right but you are not using the multiply operator. it looks like you are using x instead of *
// you wrote
var totalWidth = parseInt(width) x numOfDivs;
but it should be
var totalWidth = parseInt(width) * numOfDivs;
i hope this solves you problem
Jamie Reardon
Treehouse Project ReviewerRemove the parseInt method from the width variable.
sperera
4,017 PointsNo, that does not solve it. These are the variables used to calculate the totalWidth:
var width = '190px'; var numOfDivs = 10;
So parseInt is required to change the width from string to int.
Jamie Reardon
Treehouse Project ReviewerI see, I presumed you already declared a width variable that held a integer from using the parseInt method. I didn't see the video.
sperera
4,017 Pointssperera
4,017 Pointsoh my goodness.. yes! thanks a lot!