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
For the first part of the task I came up with this cold however for some reason it doesn’t seem to work.
const width = '190px';
const totalImages = 10;
parseInt(width);
let totalWidth = totalImages * width;
1 Answer
Martin Sole
82,199 PointsHi
You have the right idea, but you need to use parseInt(width) in your sum, so
let totalWidth = totalImages * parseInt(width) ;
At the moment in your example parseInt(width) isn't assigned to anything so the string value of width(190px) is still being used in the sum.