Help with buttons?

Hello guys! I mostly finished my weather project and i’m super excited! However,the user story says " I can toggle a button to switch from Celsius to Fahrenheit and vice versa.However,i have two buttons. Is it really necessary to have only one? Even though it isn’t necessary I still want to know how to do that with a button.
Suggestions?
Here is my codepen link :

Not necessary I don’t think. I take the user stories more as a guideline than a strict rule.

You are going to need to use a conditional, or an if statement. Something like this:

if (button.text == 'F') button.text = 'C'
else button.text =  'F'

You can, therefore, check which condition exists on the button before running whatever you need to do.

If you are using jQuery, they have functions in place that make this easier for you, but I would suggest you figure out how to do it with an if/else statement as that is a “must” for you to learn.

Personally I at least think it looks fine like this, especially as it works.

If you wanted to do one button though for example you could have say a boolean var tempIsF = true/false, and have a default condition (say temp starts out as in F). Apply that text to the one button as default. Then have one single click function for that button which checks the boolean var. If it is already true, do nothing, if false, set to true, use jquery to update the text of the button and do the appropriate calculations as you are doing now.