title: When to use setAttribute vs .attribute= in JavaScript?
body: <p>Has a best-practice around using <code>setAttribute</code> instead of the dot (<code>.</code>) attribute notation been developed?</p>
  
  <p>E.g.:</p>
  
  <pre><code>myObj.setAttribute("className", "nameOfClass");
  myObj.setAttribute("id", "someID");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>myObj.className = "nameOfClass";
  myObj.id = "someID";
  </code></pre>