Local Weather Feedback

Good morning everyone. I just finished my Local Weather project and was hoping to get some feedback. I’m really looking to refactor the JS if at possible. Thanks everyone.

Link: https://codepen.io/traekwells/pen/vWKjNy

You could get rid of:

  function convertToCelsius() {
    temperature.innerHTML = celsius;
  function convertToFahrenheit() {
    temperature.innerHTML = fahrenheit;

and replace with one function:

  function convertTo(unit) {
    temperature.innerHTML = unit;

if you change your event listeners to:

  toCelsius.addEventListener("click", function() { convertTo(celsius) });
  toFahrenheit.addEventListener("click", function() { convertTo(fahrenheit) });

Makes perfect sense. Thanks for the feedback! Appreciate it.