Challenge Convert Celsius to Fahrenheit - thelastmile/FreeCodeCamp GitHub Wiki
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
You are given a variable celsius
representing a temperature in Celsius. Create a variable fahrenheit
and apply the algorithm to assign it the corresponding temperature in Fahrenheit.
Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.
- Explain what is asked in an easy to understand way.
- Take a look at the code, there is an area that you're not supposed to edit, from there ask yourself, what is used there that I don't see before?
- Keep in mind the
order of operation
check the link in the link section for more information.
Solution ahead!
function convertToF(celsius) {
// Only change code below this line
var fahrenheit = (celsius * (9/5)) + 32;
// Only change code above this line
if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}
// Change the inputs below to test your code
convertToF(30);
- Make sure the proper order is followed with arithmetic using
()
when needed. - Declare the
fahrenheit
variable.
If you found this page useful, you can give thanks by copying and pasting this on the main chat: Thanks @Rafase282 for your help with Checkpoint: Convert Celsius to Fahrenheit
NOTE: Please add your username only if you have added any relevant main contents to the wiki page. (Please don't remove any existing usernames.)