title: How to draw a star by using canvas HTML5?
body: <p>Am trying to draw a star using canvas, but the code is not running. I want to understand: what are the steps to measure the Y and X coordinate? How to find them? to draw any shape?</p>
  
  <pre><code>&lt;html&gt;
   &lt;head&gt;
     &lt;meta charset = "utf-8"&gt;
     &lt;title&gt;Drawing Lines&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
     &lt;canvas id = "drawLines" width = "400" height = "200" 
       style = "border: 1px solid Black;"&gt;
     &lt;/canvas&gt;
     &lt;script&gt;
       var canvas = document.getElementById("drawLines");
       var context = canvas.getContext("2d")
  
       canvas.beginPath(); 
       canvas.moveTo(50,50);
       canvas.lineTo(120,150);
       canvas.lineTo(0,180); 
       canvas.lineTo(120,210);
       canvas.lineTo(50,310);  
       canvas.lineTo(160,250);
       canvas.lineTo(190,370);
       canvas.lineTo(220,250);
       canvas.lineTo(330,310);
       canvas.lineTo(260,210);
       canvas.lineTo(380,180);
       canvas.closePath();
       canvas.stroke();
     &lt;/script&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>