Fundamentals Part 4: Why doesn't this work for tempConversion?


For converting a Fahrenheit temperature to Celcius, can someone explain why my code isn’t passing the tests? I don’t believe I’ve gotten the actual math wrong, so I’m assuming it’s something about how I’m calling the toFixed method, but I’m not sure what.

  const ftoc = function(tempFahrenheit) {
			let convertedTemp = 5/9 * (tempFahrenheit - 32);
			return Number(convertedTemp).toFixed(1);


What output are you getting from the tests?


I believe you are accidentally returning a string instead of a number.

Try changing

return Number(convertedTemp).toFixed(1);


return Number(convertedTemp.toFixed(1));

and see if that fixes your problem :wink: