BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup

Join the forum, it's quick and easy

BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup
BullyWiiHacks
Would you like to react to this message? Create an account in a few clicks or log in to continue.
BullyWiiHacks

Gaming, Modding & Programming

Important reminders:

- Click *HERE* for advanced forum search or check out the text field below on the front page for Google before posting
- NO support via private message (use the forum)
- Write meaningful topic titles
Site Translation
Latest topics
Search
 
 

Display results as :
 


Rechercher Advanced Search

December 2024
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Calendar Calendar

Country Statistics
Free counters!

You are not connected. Please login or register

Converting Fahrenheit <-> Celsius Manually & w/ JavaScript

2 posters

Go down  Message [Page 1 of 1]

SnB@BWH

SnB@BWH
Admin & Writer

Have you ever wondered what the temperature is, but instead it tells you in the wrong type and you don't know what it is, so you have to look it up? Well, after reading this, you won't have to. You'll hopefully be able to do it in your head.


To convert Celsius to Fahrenheit use the following formula.

Multiply the temperature by 9.
Divide the number you got by 5.
Then add 32.

To convert Fahrenheit to Celsius use the following formula.

Subtract 32 from the temperature.
Multiply that number by 5.
Then divide that number by 9. 

But what if you were too lazy to convert it in your head? You can use a programming language such as JavaScript to do the conversion for you.

Code:

var celsius = 30;
var celsiusInF = (celsius*9)/5 + 32;
console.log(celsius + '°C is ' + celsiusInF + '°F');
var fahrenheit = 20;
var fahrenheitInC = ((fahrenheit - 32)*5)/9;
console.log(fahrenheit + '°F is ' + fahrenheitInC + '°C');

If you were to type that code into a JavaScvript console, it will output the following.

Converting Fahrenheit <-> Celsius Manually & w/ JavaScript Screen17

I'm sure if you were in Grade 3, you'd know how the mathematical formula works, but you might not understand how the JavaScript code works. So, let me break it down for you.

Code:
var


Stands for variable. A variable is used to store a value and use it for later.

Code:
var celsiusInF = (celsius*9)/5 + 32;

Means that the value used in the variable "celsius" is multiplied by 9. That number is then divided by 5 and then added with 32.

Code:
console.log

Means to output a value, such as a string, an answer to an equation or both. For this, it's both.

Code:
console.log(celsius + '°C is ' + celsiusInF + '°F');

Means to output the value of the variable celsius, add the string "°C is ", add the value of the variable celsiusInF, then finally add the string "°F". By "add" I mean to add together not to use addition!

The output will be "30°C is 86°F", provided that you used 30°C as the value for the variable "celsius".

There you go! I hope you learned something!  Smile


_________________
Converting Fahrenheit <-> Celsius Manually & w/ JavaScript Simple10

Converting Fahrenheit <-> Celsius Manually & w/ JavaScript LSTjSyDDiscord: SnB_BWH

Click HERE to earn free bitcoin, litecoin, dogecoin, and dash!

Win Free Bitcoins every hour!

Bully@WiiPlaza

Bully@WiiPlaza
 
 

Great stuff!

The JavaScript console can be found in the Chrome developer tools for example.

Converting Fahrenheit <-> Celsius Manually & w/ JavaScript Chrome10


_________________
Converting Fahrenheit <-> Celsius Manually & w/ JavaScript YBjg74I

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum