Floundering with JavaScript task - HELP! I'm drowning

Floundering with JavaScript task - HELP! I'm drowning


I am a newbie
I am sure you will recognize the mess below!
The instructions are to convert C to F degrees.
Problem is there was no lesson about using function variables
…or how to use the apparent variable definition in your code to create calculations

I cannot find this anywhere I look!
Anybody throw me rope?

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line

 var celcius = ();??????????
  fahrenheit = celcius *(9/5)+32; 
  // Only change code above this line
  return fahrenheit;
// Change the inputs below to test your code


You don’t have to create a celsius variable. It is being passed in as a parameter to the function. This means you have access to it while inside the function brackets.

Your code should work if you remove the line with all the question marks. Then, when the following line runs:

fahrenheit = celsius * (9/5) + 32;

celsius will be equal to the value that’s passed in when invoking (calling) the function.

In the case of that code example, if you look at the last line, convertToF(10) means celsius will have a value of 10 inside the scope of the function.

For further help understanding functions, consider going through this part of the Codecademy JS track:


I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.