title: Check if class already assigned before adding
body: <p>In jQuery, is it recommended to check if a class is already assigned to an element before adding that class? Will it even have any effect at all?</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;label class='foo'&gt;bar&lt;/label&gt;
  </code></pre>
  
  <p>When in doubt if class <code>baz</code> has already been assigned to <code>label</code>, would this be the best approach:</p>
  
  <pre><code>var class = 'baz';
  if (!$('label').hasClass(class)) {
    $('label').addClass(class);
  }
  </code></pre>
  
  <p>or would this be enough:</p>
  
  <pre><code>$('label').addClass('baz');
  </code></pre>