jeudi 27 février 2020

How can I convert this to an Arrow Function? [duplicate]

Is it possible to rewrite this code to an Arrow Function?


    const inputEl = document.querySelector("input");
inputEl.addEventListener("keyup", fixLength);

function fixLength() {
  let inputString = inputEl.value;
  if (inputString.length > 12) {
    inputString = inputString.slice(0, 12);
    inputEl.value = inputString;
  }
}

Aucun commentaire:

Enregistrer un commentaire