()
| 80 | |
| 81 | // WHEN THE USER CLICKS ON THE TEMPERATURE ELEMENET |
| 82 | function toggleUnits(){ |
| 83 | if(weather.temperature.value === undefined){ |
| 84 | //if the value is undefined then simply come out of the fuction |
| 85 | return; |
| 86 | } |
| 87 | if(weather.temperature.unit === 'celsius'){ |
| 88 | let fahrenheit = Math.floor(celsiusToFahrenheit(weather.temperature.value)); |
| 89 | tempElement.innerHTML = `${fahrenheit}<span>°F</span>`; |
| 90 | weather.temperature.unit = 'fahrenheit'; |
| 91 | } else { |
| 92 | tempElement.innerHTML = `${weather.temperature.value}<span>°c</span>`; |
| 93 | weather.temperature.unit = 'celsius'; |
| 94 | } |
| 95 | } |
| 96 | tempElement.addEventListener('click', toggleUnits); |
nothing calls this directly
no test coverage detected