Freecodecamp: "Reference error: Fahrenheit not defined" shows up before starting challenge

Created on 19 May 2016  路  15Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Convert Celsius to Fahrenheit has an issue.
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 7978.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.103 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


function convertToF(celsius) {
  // Only change code below this line
  var a=32;
  var b=9/5;
  var c=30;

  var d= a + b * c;


  // Only change code above this line
  return fahrenheit;
}

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

first timers only help wanted

All 15 comments

@TrentHand thanks for the issue. The instructions do say:

Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit.

So although the instructions do say to create the variable, the fact that you can't see any of the tests before you write the code may seem alarming and different from all the other challenges.

cc/ @FreeCodeCamp/issue-moderators should we at least define the variable fahrenheit for them before they start coding? Considering we haven't introduced functions at this point, I think this would be helpful. But I'm open to suggestions.

@erictleung agreed. looks like this is an oversight no one saw earlier. But they have been introduced to variables at least, nevertheless, I guess we should be defining it.

Anyone wanting to fix this needs to change the lines around here to:

"function convertToF(celsius) {",
"  var fahrenheit;",
"  // Only change code below this line",
"  ",
"  ",
"  // Only change code above this line",
"  return fahrenheit;",
"}",

And you'll also to change the instructions to be consistent to something like:

You are given a variable celsius representing a temperature in Celsius. Use the variable fahrenheit already defined and apply the algorithm to assign it the corresponding temperature in Fahrenheit.

@erictleung Just curious, since the fix is clear and you essentially just outlined what had to be done, are you leaving this open to help new people get their first PR approved? Please note - I'm a complete newbie who hasn't submitted any PR and want to make sure I understand what is going on. Thanks!

@BoDonkey That is correct. This PR is for first-timers-only. Seeing as you haven't created a PR yet, why not make this your first one :tada:

Please, check our Guidelines for Contributing and if you need any assistance reach out to the Contributors Chat room.

I'll start working on it after work or first thing tomorrow morning! I actually remember this from when I was going through this section.

Hi everyone! The error is still showing up this morning. Is this request still open?

Huh, that is odd - it shows up correctly in the seed here.
Not sure why it isn't coming through online. I'm too much of a newbie to troubleshoot further, but I'll be listening for people to chime in.

Hi @TrentHand and @BoDonkey the code is yet to reach the main website, it happens every couple of days when we push a bunch of fixes and updates together to the main site.

We request you to bear with us meanwhile.

Thanks and Happy Coding!

I believe the code is incomplete:
function convertToF(celsius) {
var fahrenheit;

NB: var fahrenheit isn't assigned to the parameter "celsius" of the above function, and as the instruction below states the the student shouldn't edit it thus the function won't work

// Only change code below this line

// Only change code above this line
return fahrenheit;
}

<hr>

This is my example:

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

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

@nellee24
Please do not post your solution on here. You could help people at FreeCodeCamp Chat Room or Forum. GitHub Issues are for reporting bugs on the website only.

Happy Coding!

I think that sometimes it really helps to see the correct code. Of course some explanations and the way how to get there would be useful too. If everyone would post their code snippets here with asking for help, this forum would be probably a mess.
I prefer asking for further explanations if there should be some remaining, however often after seeing the code, everything becomes clearer :) usually the question is unclear or too difficult to get although the code in the end appears to be very simple :)

@texas2010
Im trying to help and simplified the code of @ArmantHitchcock. :)

Challenge Convert Celsius to Fahrenheit has an issue.
i don't know how to solve this challenge

you have to modify the text above the line, against the instructions. celsius is not defined and will spit out an error.

var fahrenheit = celsius;

Was this page helpful?
0 / 5 - 0 ratings