javascript - Uncaught SyntaxError: Unexpected identifier with canvas in js -


here html code:

<!doctype html> <html> <body> <canvas id="mycanvas" width="600" height="600" style="border:1px solid     #000000;"> </canvas> <script src="pro checkers.js"></script> </body> </html> 

here javascript code:

class board {     var ct = document.getelementbyid("mycanvas");     var c = ct.getcontext("2d");     function draw_board()     {         c.fillstyle = "rgb(220,220,220)";         c.fillrect(0,0,600,600);         c.fillstyle = "rgb(50,50,50)";         (i=0;i<4;i++)         {             (j=0;j<4;j++)             {                 c.fillrect(i*150,j*150,75,75);             }         }         (i=0;i<4;i++)         {             (j=0;j<4;j++)             {                 c.fillrect(i*150+75,j*150+75,75,75);             }         }     } } class pices {     update();     var pices = ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];     var face_pices = ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];     function update()     {         draw_board();         draw_pices();     }     function draw_pices()     {         c.beginpath();         c.arc(95,50,40,0,2*math.pi);         c.stroke();     } } 

the error canvas defined in javascript here:

var ct = document.getelementbyid("mycanvas"); var c = ct.getcontext("2d"); 

it says:

pro checkers.js:2 uncaught syntaxerror: unexpected identifier

i trying make checkers engine , start not working wrong?

thanks!


Comments