Convert Celsius to Fahrenheit Challenge: Possible Bug

Tell us what’s happening:

So I was doing this challenge and the entered the code below which I did not think would work but it did…I was just wondering if this was the correct way to do it or not…because it gave me a pass. Thank’s for response in advance!

Your code so far

function convertToF(celsius) {
  var fahrenheit = (celsius * 9/5) + 32;
  // Only change code below this line
  celsius = celsius * fahrenheit;
  
  // Only change code above this line
  return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/convert-celsius-to-fahrenheit

The celsius = celsius * fahrenheit line is incorrect, but unnecessary. In no way does it affect the fahrenheit value.

hmm…I still don’t know why it gave me a pass so I did something right…

It passed because you correctly converted Celsius to Fahrenheit. The second line barely has any consequences (you can actually remove it), so you’re good :+1:

1 Like

Thank you man! :grinning: