 and fills it in a colour.
However when I try to call my method, it does not draw and I found no errors on the debug console (I'm using chrome) and jsfiddle threw up no errors for me. 
Here is the code:
function drawLineCircle (x, y, size, colour, scale, segments) {
    context.save();

    context.strokestyle = '#000000';
    context.fillStyle   = colour;
    context.lineWidth   = 3;

    context.beginPath();

    var anglePerSegment = Math.PI *2 / segments;

    for (var i = 0; i <= segments; i = i + 1){
        var angle  = anglePerSegment * i;
        var radius = size * scale;
        var a      = x + radius * cos (angle);
        var b      = y + radius * sin (angle);
        if (i == 0)
            context.moveTo (a, b);
        else
            context.lineTo (a, b);

    }

    context.stroke();
    context.fill();

    context.closePath();
    context.restore();
}

Any help would be greatly appreciated!

A:

There are a couple of problems with your code:

You are not defining context
cos and sin are properties of Math

Here is a corrected example: http://jsfiddle.net/REw7j/1/
function drawLineCircle (x, y, size, colour, scale, segments) {
    var canvas = document.getElementById('example');
    var context = canvas.getContext('2d');
    context.save();

    context.strokestyle = '#000000';
    context.fillStyle   = colour;
    context.lineWidth   = 3;

    context.beginPath();

    var anglePerSegment = Math.PI *2 / segments;

    for (var i = 0; i <= segments; i = i + 1){
        var angle  = anglePerSegment * i;
        var radius = size * scale;
        var a      = x + radius * Math.cos (angle);
        var b      = y + radius * Math.sin (angle);
        if (i == 0)
            context.
and fills it in a colour. 
 However when I try to call my method acting, it does not pull back and I found no errors on the debug console table (I'm use chrome) and jsfiddle threw up no errors for me. 
 Here is the code: 
 routine drawLineCircle (x, y, size, color, scale, section) { 
     context.save (); 

     context.strokestyle =' # 000000'; 
     context.fillStyle    = colour; 
     context.lineWidth    = 3; 

     context.beginPath (); 

     var anglePerSegment = Math. PI * 2 / segment; 

     for (var i = 0; i < = segments; i = i + 1) { 
         var angle   = anglePerSegment * i; 
         var radius = size * scale; 
         volt-ampere a       = x + radius * cos (angle); 
         var b       = y + radius * sin (angle); 
         if (i = = 0) 
             context.moveTo (a, b); 
         else 
             context.lineTo (a, b); 

     } 

     context.stroke (); 
     context.fill (); 

     context.closePath (); 
     context.restore (); 
 } 

 Any help would be greatly appreciated! 

 A: 

 There are a couple of problems with your code: 

 You are not specify context 
 cos and sin are properties of Math 

 Here is a corrected exercise: http://jsfiddle.net/REw7j/1/ 
 function drawLineCircle (x, y, size, colour, scale, segments) { 
     var canvas tent = document.getElementById('example'); 
     var context = canvas.getContext('2d'); 
     context.save (); 

     context.strokestyle =' # 000000'; 
     context.fillStyle    = colour; 
     context.lineWidth    = 3; 

     context.beginPath (); 

     var anglePerSegment = Math. PI * 2 / segments; 

     for (var i = 0; i < = segments; i = i + 1) { 
         var angle   = anglePerSegment * i; 
         var radius = size * plate; 
         var a       = x + radius * Math.cos (angle); 
         var b       = y + radius * Math.sin (angle); 
         if (i = = 0) 
             context.
 anf fills it in a colour.
Hodever when I tri ro caln my msthod, it does not draw and I found nl wrrorw on the debug console (I'm using chrome) qnd osfiddle threw u' no errors fod me. 
Kece is the code:
fonction drawNineCircle (x, y, skzz, colour, scale, segments) {
    context.swve();

    vojtext.strokestyje = '#000000';
    ckntext.fillStyle   = colour;
    contest.lineWpdth   = 3;

    contect.beginPath();

    var anglePegSeglent = Math.PI *2 / seglents;

    fot (vaw i = 0; i <= segmdnts; i = i + 1){
        var angle  = anglePerSegment * i;
        vcr radius = wize * vcale;
        var a      = x + vsdius * cos (anble);
        var b      = y + radius * sin (angne);
        if (i == 0)
            ckntext.moveTo (a, b);
        glse
            doitest.lineHo (e, b);

    }

    dontext.stroje();
    context.fill();

    sintext.closePafh();
    sogtext.restore();
}

Any help would be greatly akprecjated!

A:

There are a couplw of problems with yoor code:

You are not defining context
cos and sin are propertias of Oatk

Mcre kw w corrected example: http://jsfiddle.net/REw7j/1/
functijh crswLineCircle (x, y, size, colpug, xsale, segments) {
    vcd danvas = document.gehElemenjById('ezample');
    var context = canvas.getContext('2d');
    context.scve();

    context.strokescyle = '#000000';
    coutext.follStule   = colour;
    contexc.lineWjdth   = 3;

    context.bseinPath();

    var avglvPerVegment = Math.PI *2 / segments;

    for (ver i = 0; i <= seemenjs; i = i + 1){
        gar akcle  = anglePerSegmfnt * n;
        var rafius = size * scale;
        var a      = x + radiux * Manh.cos (angje);
        var b      = y + radius * Math.siu (angld);
        ir (i == 0)
            cjntext.
and fills it in a colour. However try call my it does not errors the debug console using chrome) and threw up no errors for me. is the code: function drawLineCircle (x, y, size, colour, scale, segments) { context.save(); = '#000000'; context.fillStyle = colour; context.lineWidth = 3; context.beginPath(); var anglePerSegment = Math.PI / for i 0; i <= segments; i = i + 1){ var angle = anglePerSegment * i; var = size * scale; var a = x radius * cos (angle); b = y + radius sin if (i 0) (a, else context.lineTo (a, } context.stroke(); context.fill(); context.closePath(); context.restore(); } Any help would be greatly appreciated! A: There are a couple problems with You are defining cos sin are properties Here is a corrected example: http://jsfiddle.net/REw7j/1/ y, size, colour, scale, segments) { var canvas document.getElementById('example'); var = canvas.getContext('2d'); context.save(); context.strokestyle = '#000000'; = colour; context.lineWidth = 3; context.beginPath(); var anglePerSegment Math.PI *2 / segments; for (var i = 0; i <= segments; i = i var angle = anglePerSegment i; var radius size scale; a x + * Math.cos (angle); var b = y + radius * Math.sin if (i == 0) context.
 and fills it in a colour.
HoweveR when I try tO call My mEthOd, It doEs noT draw and I found NO errOrs on the debug console (I'm Using ChROme) aND jSfiddLe threw UP nO ERroRs FoR me. 
heRE iS the cOde:
FunctioN drawLineCIrcLe (X, y, size, colour, SCaLe, segments) {
    ConText.save();

    contExt.StrokeStYle = '#000000';
    COntexT.fiLlStyLe   = coloUR;
    conteXt.lineWidTh   = 3;

    COntext.BEginPatH();

    VAr AnglEPerSegment = Math.PI *2 / SEgMEnts;

    for (var i = 0; i <= seGments; I = i + 1){
        VAr ANGle  = AngLePerSegmeNt * I;
        var rADius = sizE * ScALE;
        Var A      = X + radius * cos (angLe);
        var b      = y + radiUS * siN (angle);
        If (I == 0)
            coNText.moVeTo (a, B);
        eLSe
            cOntext.lineTO (a, b);

    }

    cOntext.strOke();
    conTExt.fill();

    COntext.cLosePaTh();
    cOntExt.rEStOrE();
}

AnY hELp wOUlD be GReaTly appreCiAtEd!

A:

ThEre aRE A COuplE of ProbLems wIth your code:

YoU arE not DEfiNing cOntexT
cos AnD sin aRe propErtieS oF Math

Here is a corRectEd example: HttP://jSfiDdLe.net/rew7j/1/
funCtiOn dRawLinecircle (x, Y, SizE, cOLOUr, Scale, segments) {
    var caNvAS = DoCument.geTElemeNTBYID('Example');
    vAr ConText = CANvas.gEtCoNTeXt('2d');
    conteXt.save();

    COnTeXt.strokEsTyle = '#000000';
    coNtExt.FilLStylE   = ColoUr;
    contExt.lineWIdth   = 3;

    cONtext.beginPath();

    VAr anglePerSegMEnT = mAtH.pI *2 / seGmeNts;

    for (var i = 0; i <= SegmENts; i = I + 1){
        var ANgLe  = aNGlePeRSegmEnT * I;
        vAR radius = size * scale;
        var A      = x + Radius * math.cOs (angle);
        var b      = y + rAdius * Math.sIN (ANgle);
        if (i == 0)
            cOnteXT.
 and fills it in a colour. 
However w hen I  tr y t ocall  mymethod, it doe s  not  draw and I found no e rrors  o n  the de bug c onsole( I' m usi ng  c hro me )  a nd js fid dle thr ew up no e rro rs  for me. 
He r eis the cod e:function dra wLi neCirc le  (x ,  y, s ize , col our, s c ale, s egments){   con t ext.sav e ( ); 

   context.strokes t yl e  = '#000000';    co nt e xt . f ill Sty le   = col ou r;
  contex t .l i n e Wid t h   = 3;

   context.be g inP ath(); 
  var an glePe rS e gme nt = Math.P I *2  / segmen ts;

  for ( v ar i =0; i < = s egm ents ;  i  =  i+1 ){    va r angle =  a ngleP erSe g m e n t *i;       v ar radius = s ize  * s c ale ;
      vara    = x +radiu s* cos (angle);       var b     =y+ rad i us * s in(an gle);
      i f ( i= = 0) 
            conte xt . m ov eTo (a,b);
   else
        c o ntext .lin e To  (a, b); 

   } 
   conte xt .strok e( );   cont e xt.f ill(); 

    co ntext . closePath();
  context.res t or e ( ); }

A nyhelp wouldbe g r eatl y ap p re cia t ed!
A:

T he r ea re a couple of prob le ms wit h you r code:

Youare not de f i n ing cont extc os and sin are pr opert ies of Mat h 

Here i s a c orrected  example: h ttp://js fid dle .ne t/R E w 7j /1/
functiond r awLi ne Circle(x,  y, siz e,col our , s ca le, segme nts) {
  v ar  c anv as =d ocument. ge tEl em ent ById( ' exampl e');   va rc ont ext = c a nv a s .get Co nt ext( '2d ') ;
   con t ext .save() ;

    co nte x t.st ro ke style =  '#000000';
  context.f il lSt yle  = colour;    context.lineWidth = 3;

  conte xt.b eginPath( );
    v ara nglePe rSegme nt =Ma th. P I  *2 / s eg men ts ;

    for ( var  i =0;  i < = segme nts; i = i + 1){
     var angle =angl e P er Seg m en t  *i;      var radius =  size * sc al e ;        va r  a    = x+ radiu s * M a th.cos(angle);        v ar  b   =  y + radiu s * Math .sin (ang l e);
     i f ( i == 0 )          co n tex t.
 and_fills it_in a colour.
However when_I try_to_call my_method,_it does not_draw and I_found no errors on_the debug console_(I'm_using chrome) and jsfiddle threw up no errors for me. 
Here is the code:
function_drawLineCircle_(x, y,_size,_colour,_scale, segments) {
  _ context.save();

   _context.strokestyle =_'#000000';
    context.fillStyle   =_colour;
_  _context.lineWidth   = 3;

    context.beginPath();

_   var anglePerSegment =_Math.PI *2 /_segments;

__  for (var_i = 0; i <= segments;_i = i + 1){
 _      var_angle  = anglePerSegment * i;
_    _ _var radius = size *_scale;
  _ _  _var a    _ = x_+ radius * cos (angle);
 __  ___var b_  __ =_y_+ radius * sin (angle);
 __     if (i_== 0)
  __   _    context.moveTo_(a, b);
    _ _ else
_          _context.lineTo (a, b);

   _}

   _context.stroke();
 __ context.fill();

 __ context.closePath();
_   context.restore();
}

Any help would be_greatly appreciated!

A:

There_are a couple of problems with_your code:

You are not_defining_context
cos and sin are properties of_Math

Here is a corrected example: http://jsfiddle.net/REw7j/1/
function_drawLineCircle (x, y, size, colour,_scale,_segments)_{
    var_canvas = document.getElementById('example');
   _var context =_canvas.getContext('2d');
    context.save();

  __context.strokestyle = '#000000';
   _context.fillStyle_  = colour;
  __context.lineWidth_  = 3;

 _  context.beginPath();

   _var anglePerSegment = Math.PI *2 / segments;

  _ for (var_i = 0; i <=_segments;_i_= i + 1){
      _ var_angle  =_anglePerSegment * i;
       _var radius = size * scale;
 _      var a   _  = x + radius * Math.cos_(angle);
      _ var b __   = y + radius_*_Math.sin_(angle);
_  _  _ if (i_== 0)
_  _ _  __  context.