title: How can i draw a Square in HTML5 Canvas at run time?
body: <p>I am working on a HTML5 Project.There is a drawing graphics API to draw Rectangle (fillRectStrokeRect).But how can i draw a SQUARE. I have tried the following way to draw it
  <strong>CODE</strong></p>
  
  <pre><code>getMouse(e);
  x2=mx; y2=my;
  var width=endX-startX;
  var height=endY-startY;
  
  annCanvasContext.beginPath();
  annCanvasContext.lineWidth=borderWidth;
  var centerX=width/2;
  var centerY=width/2;
  var radius=width/2;
  annCanvasContext.arc(centerX+5, centerY+5, radius, 0, 2 * Math.PI, false);
  annCanvasContext.stroke();
  </code></pre>