title: TypeError: canvas.width() & canvas.height() is not a function
body: <p>I have written a simple jQuery code and I am getting this error:</p>
  
  <blockquote>
    <p>TypeError: canvas.width() &amp; canvas.height() is not a function</p>
  </blockquote>
  
  <p>When declaring variables <code>w</code> and <code>h</code> it is showing an error of <code>canvas.width()</code> and <code>canvas.height()</code> is not defined. This is my code:</p>
  
  <pre><code>$(document).ready(function() {  
    var canvas = $('#canvas')[0];  
    var ctx = canvas.getContext('2d');  
    var w = canvas.width();  
    var h = canvas.height();  
    var cw = 15;  
    var d = "right";  
    var food;  
    var score;  
    var speed = 130;
  )};
  </code></pre>