JavaScript JavaScript Numbers Working with Numbers Numbers and Strings

Kevin Leong
Kevin Leong
1,652 Points

Javascript 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;
const totalWidth = width * totalImages;

1 Answer

Hello 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.