Conversion from Fahrenheit to Celsius and Vise-Versa


#1

At the moment, I have been able to request temperature from DarkSky’s API, but degrees are in Fahrenheit when displayed on the user’s screen. Consequently, I was wondering if could wrap my existing JS code with that button so that I could convert from Celsius to Fahrenheit and vise-versa? Perhaps I need to wrap the my temperature id in a button and use a function of some sort?

Here’s my codepen: https://codepen.io/baquino1994/pen/ayJOod?editors=1011


#2

You can read the current temperature from your page with $('#temp').text() and use that for your temperature conversion.


#3

That’s what I did with my project and just ran the conversion formula on the output.