Code
Execute
<!DOCTYPE html> <html> <head> <title>wikitechy lineTo Method in canvas</title> </head> <body> <h2>wikitechy lineTo Method in canvas</h2> <canvas id="wikitechyCanvas" width="200" height="150" style="border:1px solid blue;"> </canvas> <script> var c = document.getElementById("wikitechyCanvas"); var context = c.getContext("2d"); context.beginPath(); context.moveTo(0, 0); context.lineTo(200, 150); context.stroke(); </script> </body> </html>
Result