# convertToF Celcius to Fahrenheit

Tell us what’s happening:

What is wrong with this and how do i pass this???

Your code so far

``````function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
0 = (celcius * (9/5)) + 32;
-30 = (celcius * (9/5)) + 32;
-10 = (celcius * (9/5)) + 32;
0 = (celcius * (9/5)) + 32;
20 = (celcius * (9/5)) + 32;
30 = (celcius * (9/5)) + 32;
// Only change code above this line
return fahrenheit;
}

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

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36`.

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

I think your idea for the function is wrong
The function returns a variable “fahrenheit”
in the body of the function you need a general formula for calculating the value of “fahrenheit” using the parameter “celsius”
and finally in the last part you test with different value of celsius

In a line like this " 0 = (celcius * (9/5)) + 32;" ( you wrote)
you are actually assigning the value of the right-hand side to the left-hand side of the equal sign
the problem is 0 is not a variable, it’s a fixed number, you can’t assign value to it…

im guessing you wanted to use a switch statement like:

function convertToF(celsius) {
var fahrenheit;
switch(celsius){
case 0:
fahreneit = (celcius * (9/5)) + 32;
break;
case - 30:
fahreneit = (celcius * (9/5)) + 32;
break;
etc…
default:
break;
}
// Only change code above this line
return fahrenheit;
}