Alonzo Delk4,830 Points
Do I multiply by the totalWidth? Or do I add another variable with the purseInt stating the amount?
const width = '190px'; const totalImages = 10; const totalWidth = width * totalImages; const num = 1900; const webValue = parseInt(1900);
Peter Vann36,049 Points
Your goal is to multiply the width by totalImages.
width, however, is a CSS string property value, so for the math to work properly you have to cast/convert width to a number ( using parseInt() ).
So the code is actually this simple (and passes)
const width = '190px'; const totalImages = 10; const totalWidth = parseInt(width) * totalImages;
Note: parseInt, in this case, casts/converts '190px' to 190, thus after the multiplication, totalWidth will be 1900.
(190 * 10) == 1900, in other words...
BTW, if you really want to see it, open your devtools and find the console.
At the prompt type:
> const width = '190px';
And hit enter. It will return undefined, which is fine.
> console.log( parseInt(width) );
It will return:
You can ignore the undefineds (undefined is the return value of console.log() regardless of what it logs)
(If you type 2 + 2 at the prompt it will return 4, not undefined).
I hope that helps.
Stay safe and happy coding!