Returning a string instead of a number

Hello, everyone!

I can’t understand why the function seems to work correctly, but the exercise does not count and an error is displayed on the screen: "When the planet is Mercury, the function should return the weight passed in multiplied by .378"

const calculateWeight = (earthWeigt, planet) => {
switch(planet) {
case ‘Mercury’:
planetWeight = Math.floor(earthWeigt * .378);
return ${planet} weight - ${planetWeight};
break;
case ‘Venus’:
planetWeight = Math.floor(earthWeigt * .907);
return ${planet} weight - ${planetWeight};
break;
case ‘Mars’:
planetWeight = Math.floor(earthWeigt * .377);
return ${planet} weight - ${planetWeight};
break;
case ‘Jupiter’:
planetWeight = Math.floor(earthWeigt * 2.36);
return ${planet} weight - ${planetWeight};
break;
case ‘Saturn’:
planetWeight = Math.floor(earthWeigt * .916);
return ${planet} weight - ${planetWeight};
break;
default:
return ‘Invalid Planet Entry. Try: Mercury, Venus, Mars, Jupiter, or Saturn.’;
break;
}
}

And yes, do not pay attention to Math.floor(), I just added a little from myself. I’m sure that this does not affect the problem.

Please help. Thank you in advance

1 Like

you should just return the planetWeight (the number), not a string. I also don’t see any mentioning of the need to round down?

Oh yes, I really got carried away. I understand that all user options, even if they are correct, cannot be verified at this stage.
Thank. I will continue to read the instructions carefully)

also you spelled “earthWeight” wrong, idk if that affected it or not.