title: How to draw an image in a canvas
body: <p>So I was trying to draw an<code>img</code>in a canvas I tried everything but in the console it says <code>img is not a property</code> or something like that I don't remember so can anyone help?
  Here's the js</p>
  <pre><code>function setupcanvas() {
    var canvas = document.querySelector('canvas')
    var c = canvas.getContext(&quot;2d&quot;)
    c.beginPath();
    var img = new image()
    img.src = &quot;flappy_bird_bird.png&quot;
    img.onload = function(){
      c.drawImage(img, 100, 100)
    }
  }
  </code></pre>
  <p>Edit
  Thx to mhkanfer &quot;sorry if the name is wrong&quot; I fixed it</p>