Need help- in finding smallest and largest within one function

I have defined a function to foind out the smallest word’s length but I want to add a conditional statement and a button in html file so that it could find out the largest one’s length too. but I got stuck in it
Your code so far

function findSmallestStr() {
  let inpEl = document.querySelector("#inPut3");
  let strList = inpEl.value.split(" ");

  // add if button large do ...
  // ??
  // if button small do below
  let smalestWord = strList.reduce((x, y) => {
    return y.length < x.length ? y.length : x;
  }, strList[0]);
  outPut.textContent = `The largest word in your text has ${smalestWord} charactors.`;

  inpEl.value = "";
  inpEl.focus();
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0.