# moveTo method

The `moveTo` method moves the drawing pen to the specified point without drawing anything. From this point, you can then start drawing with the `lineTo` method.

## Syntax

`context.moveTo(x, y);`

## Example

Let's draw a line:

`<canvas id="canvas" width="200" height="200" style="background: #f4f4f4;"></canvas>` `let canvas = document.querySelector('#canvas'); let ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(50, 50); ctx.lineTo(150, 50); ctx.stroke();`

:

## See also

- the `lineTo` method
  that draws lines

← →
↑
en ru