title: Javascript Canvas drawing an octagon
body: <p>Working on Javascript Canvas drawing an octagon and I have this function and code, but its not working for some reason. Any ideas?</p>
  
  <pre><code>function drawMe()
  {   
  var numberOfSides = 8;
      size = 10;
      Xcenter = 100;
      Ycenter = 100;
  
  cxt.beginPath();
  cxt.moveTo (Xcenter +  size * Math.cos(0), Ycenter +  size *  Math.sin(0));          
  
  for (var i = 1; i &lt;= numberOfSides; i += 1) 
  {
      cxt.lineTo (Xcenter + size * Math.cos(i * 2 * Math.PI / numberOfSides), Ycenter + size * Math.sin(i * 2 * Math.PI / numberOfSides));
  }
  
  cxt.strokeStyle = "#000000";
  cxt.lineWidth = 1;
  cxt.stroke();
  }
  </code></pre>