title: Set an HTML attribute with a Javascript variable?
body: <pre><code>&lt;script&gt;
      var canvasWidth = 800;
      var canvasHeight = 600;
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to use these variables to set the attributes of an HTML tag
  This is not syntactically correct, but shows how I am wanting to use the variables:</p>
  
  <pre><code>&lt;canvas id="context" width='canvasWidth' height='canvasHeight' style="border: 1px solid #000000;"&gt;&lt;/canvas&gt;
  </code></pre>
  
  <p>How might I do this? Is this even good practice? How would you recommend I control the canvas size, as well as clear the canvas using JavaScript?</p>