title: Avoiding repetition when dynamically creating HTML elements in JavaScript
body: <p>I'm creating a button using javascript, and adding it to the page. This means I'll need an event, a class, and some text for the button, however, my current approach repeats the <code>aButton</code> five times, which seems excessive. I know that it's possible for simple attributes <a href="https://stackoverflow.com/questions/12274748/setting-multiple-attributes-for-an-element-at-once-with-javascript">(link)</a>, but this doesn't seem to work with <code>innerHTML</code> and <code>onclick</code></p>
  
  <pre><code>let aButton = document.createElement('button');
  aButton.classList.add("button-class");
  aButton.innerHTML = "button text";
  aButton.onclick = buttonFunction;
  element.appendChild(aButton);
  </code></pre>
  
  <p>Is there a simpler approach using <em>vanilla JavaScript</em>? I don't mind repetition, but it seems there should be a way without repeating <code>aButton</code> five times.</p>