Starting my Javascript Bloging Journey by solving FCC's Basic Algorithm Scripting Challenges

Photo by Glenn Carstens-Peters on Unsplash

Starting my Javascript Bloging Journey by solving FCC's Basic Algorithm Scripting Challenges

Convert Celsius to Fahrenheit

M. Tahir Khan's photo
M. Tahir Khan
·Jan 22, 2022·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Hi, my name is Tahir. I have been doing responsive email templates development (front-end but from the 90s 😉). Want to switch over to full-stack development and start from Javascript.

I have been struggling with JavaScript and thought I should write about my progress as it does help in retaining the knowledge. I consider myself a step or two ahead of being a complete beginner at JavaScript.

Now, I don't have any experience in writing anything so I might have tons of mistakes.

Recently started attempting FreeCodeCamp’s Javascript Algorithms and Data Structures and I will be blogging my progress. It may not be quite consistent but I’ll try my level best to be as much as I can.

Today, I’m going to attempt a problem (Convert Celsius to Fahrenheit) from FCC’s Basic algorithm Scripting.

Here is what we are asked to do:

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. Use the variable fahrenheit already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.

This one is plain simple and we just have to add a formula (already provided) which is celsius * (9/5) + 32. The function is being passed in with a celsius value and the function should return the fahrenheit value.

Here is how I have solved it:

function convertToF(celsius) {
  let fahrenheit;
  fahrenheit = celsius * (9/5) + 32;
  return fahrenheit;
}

convertToF(30);

I'll need all of your help in my journey. Please don't hesitate to point out any mistakes/shortcomings in my post.

 
Share this