title: What is the point to use the setAttribute method when there is better way
body: <p>Here I have two functions <code>setImage1</code> and <code>setImage2</code> to add a value to the 
  <code>src</code> attribute and the <code>alt</code> attribute for the <code>dieImg</code> object.</p>
  
  <p>I find the second solution <code>setImage2</code> much easier and shorter then the first one.</p>
  
  <p>So my question is if it's any point to use the first solution where you use 
  the setAttribute metod
  The result from these two function is the same.</p>
  
  <p>A second question when do I have to use the setAttribute method ? </p>
  
  <pre><code>function setImage1(dieImg) {
    var dieValue = Math.floor(1 + Math.random() * 6);
  
    dieImg.setAttribute("src", "img/die" + dieValue + ".png");
    dieImg.setAttribute("alt", "die image with " + dieValue + " spot(s)");
  } // end function setImage1
  
  
  function setImage2(dieImg) {
    var dieValue = Math.floor(1 + Math.random() * 6);
  
    dieImg.src = "img/die" + dieValue + ".png"
    dieImg.alt = "die image with " + dieValue + " spot(s)");
  } // end function setImage2
  </code></pre>