Convert Celsius to Fahrenheit: Hard to understand

Convert Celsius to Fahrenheit: Hard to understand
0

#1

Tell us what’s happening:

Hey Guys,

First post for me. Im a designer, pretty good at HTML and CSS, but I’m a super beginner in js and thought I should bring this up for this particular project. I don’t know if it’s just me but this project topic is hard to digest and carry through with understanding for a beginner (codecademy has the same project). The reason is because first Im trying to tackle understanding the math equation of °C vs °F and also 9/5. Is it 9 divided by 5 which i assume is written 9 / 5 with spaces as i’ve only ever seen in all the other examples, or is it 9 5ths? I had to google a text to speech app to find out. This alone makes me super confused and attacked the problem in the wrong way. Also the way it’s explained or the request of what we are trying to solve for is kind of confusing as well.

I’m all for a challenge, but this particular question and the problem to solve may cause more confusion than the challenge of coding it. I feel this type of challenge leaves me confused to start and when i see the final answer I then understand what the actual ask was. I feel like just moving on instead of feeling like I learned something.

Anyways just sharing some of my insights from a very raw beginner from the designer community. I’m loving everything else so far and thank you very, very, very much for offering these courses.

Your code so far

function convertToF(celsius) {
  var fahrenheit;
  // Only change code below this line
  fahrenheit = celsius;
fahrenheit *= 9;
fahrenheit /= 5;
fahrenheit += 32; 
  
  // 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 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36.

Link to the challenge:


#2

9/5 is the same as 9 / 5. Whitespace (spaces, tabs, empty lines) are completely ignored. (Unless you’re programming in Python, but you don’t want to open that debate.)

“9 divided by 5” is also functionally identical to “9 5ths” (both are 1.8). Multiplication and division of whole numbers are commutative, so it doesn’t actually matter in this case.
I believe that one of the things that this challenge helps demonstrate is that we can do more than one operation in a line of code.
You have:

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

Which can be written instead as:

fahrenheit = celsius * 9 / 5 + 32;

JavaScript will correctly evaluate an expression according to the same order of operations that you learned in middle school.

ETA: By the way, if you ever feel that the phrasing of a challenge is confusing and you have a suggested improvement, you can open a GitHub Issue.