JavaScript JavaScript Numbers Working with Numbers Numbers and Strings

Hannah Sohn
Hannah Sohn
2,785 Points

Why is my answer not working?

Don't know what is wrong..tried so many different things but cant figure out what is the right way..

script.js
const width = '190px';
const totalImages = 10;


parseInt(width);
totalWidth = parseInt(width) * totalImages;
console.log = totalWidth;

2 Answers

Christian Beckett
Christian Beckett
11,119 Points

Bare with me here hannah Javascript isn't exactly my strong suit. but I BELIEVEEE your answer should look like this

const width = '190px';
const totalImages = 10;
var totalWidth = parseInt(width) * totalImages ;

Hope this helps :P Hannah Sohn

Christian Beckett
Christian Beckett
11,119 Points

I believe you over complicated things slightly.

Hannah Sohn
Hannah Sohn
2,785 Points

Thank you! yes I definitely did over complicate things haha, I need to stop overthinking as well. Hopefully I will understand better sooner than later, Thanks again!

Christian Beckett
Christian Beckett
11,119 Points

I think you'll do just fine hannah. I do the same thing dw :P you'll learn its not as hard as it seems. remember you have anymore questions feel free to ping me :) Hannah Sohn (plus not to worry. Javascript tends to make you overthink with all the steps it gives you but im sure youll get the hang of it)