title: Set Canvas size using javascript
body: <p>I have the following code in html:</p>
  
  <pre><code>&lt;canvas  id="myCanvas" width =800 height=800&gt;
  </code></pre>
  
  <p>I want, instead of specifying the <code>width</code> as <code>800</code>, to call the JavaScript function <code>getWidth()</code>  to get the width e.g.</p>
  
  <pre><code> &lt;canvas  id="myCanvas" width =getWidth() height=800&gt;
  </code></pre>
  
  <p>What is the correct syntax to do it? Because what I'm doing doesn't work.</p>