Met Canvas Lineto
# HTML canvas lineTo() Method
[ Canvas Object](#)
## Example
Start a path, move to position 0,0. Create a line to position 300,150:
YourbrowserdoesnotsupporttheHTML5canvastag.
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(300,150);
ctx.stroke();
[Try it Yourself Β»](#)
* * *
## Browser Support

The lineTo() method is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.
**Note:** Internet Explorer 8 and earlier versions do not support the element.
* * *
## Definition and Usage
The lineTo() method adds a new point and creates a line from that point to the last specified point in the canvas (this method does not draw the line).
**Tip:** Use the [stroke()](#) method to actually draw the path on the canvas.
| JavaScript syntax: | _context_.lineTo(_x,y_); |
| --- |
## Parameter Values
| Parameter | Description |
| --- | --- |
| _x_ | The x-coordinate of the target position of the path. |
| _y_ | The y-coordinate of the target position of the path. |
* * *

## More Examples
## Example
Draw a path in the shape of the letter L:
YourbrowserdoesnotsupporttheHTMLcanvastag.
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20,20);
ctx.lineTo(20,100);
ctx.lineTo(70,100);
ctx.stroke();
[Try it Yourself Β»](#)
* * Canvas Object](#)
YouTip