Weather App calculating wrong when clicking button

Whenever I click the Celsius or Fahrenheit letter, it’s supposed to convert and show the converted value.
However, it works at first, but when I keep clicking the letter, it started giving me a negative number, which is not the original temperature value.

This is what it looks like when I first load the page

This is what it looks like after I click the "C"

and this is what it looks like when I click the "F"

It gave me a different value from the original, is my code correct? I tried going through the code over and over, but I can’t seem to find what is causing this calculation error

Try using console.log to see the values of temp, celsius and fahrenheit just after you’ve calculated them in checkTemperatureType. You know how to see the console, right?

Incidentally, what you call celsius is the result of the conversion into fahrenheit and vice-versa. But since you used the names consistently, that’s not the cause of the bug. It just makes your code harder to understand.