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 trial

JavaScript JavaScript Basics (Retired) Working With Numbers Numbers and Strings

Supratim Nandi
Supratim Nandi
3,287 Points

problem in challenge..

I m taking my JavaScript lessons. where I found that the preview of m code is right but still the checker is showing a bummer!

can you post your code so we can see what is the issue.

4 Answers

jason chan
jason chan
31,009 Points
// there is a string we want to convert the string into an integer
var width = '190px';
var numOfDivs = 10;
// we are defining a variable named totalWidth we store the variable with parseInt "convert variable to integer" times numOfDivs
var totalWidth = parseInt(width) * numOfDivs;
var totalWidth = parseInt(width) * numOfDivs

This seemed to work for me, not sure what you wrote.

Supratim Nandi
Supratim Nandi
3,287 Points

I did it dude ....I took another variable extra...I will show you..

var width =190px; var numOfDivs=10; var convertedInt=parseInt(width); vartotalwidth=convertedInt*numOfDivs;

How is it wrong..They are Showing a Bummer.

jason chan
jason chan
31,009 Points

I wouldn't store so many variable it's not efficient code.