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 trialKevin Leong
1,664 PointsJavascript Numbers Challenge Task 1 of 1
Can't figure out what I am supposed to do for this coding challenge. I thought I did it correctly but it won't let me go
const width = '190px';
const totalImages = 10;
parseInt(width);
const totalWidth = width * totalImages;
1 Answer
Robert Ionut Muraru
Full Stack JavaScript Techdegree Graduate 22,194 PointsHello Kevin,
On line 4 you are indeed converting width
to an integer but then you are not storing that value anywhere, so on the next line when using width
to calculate the totalWidth
it still has the value of '190px' and not the integer value of 190.
To solve this you can call parseInt
on width
when you multiply it by totalImages
.