Hey guys, I added an event listener to switch the temperature from F to C, but I don’t know how to toggle back and forth with it…Advice needed please…
Hello there,
You have a few options to do this:
- Create a boolean variable (scope greater than the eventListener function), use this boolean to determine if you should display and calculate
C
orF
. - Inside the eventListener function, make a query to find out if
temperatureDegree
is displaying inC
orF
, then use logic to perform the appropriate calculation and reset theinnerHTML
.
Hope this helps
Thanks a lot, this helped me figure it out