Set the line dash offset

ctx.lineWidth = ;

ctx.lineCap = ;

ctx.setLineDash([, ]);

ctx.lineDashOffset = ;

ctx.beginPath();

ctx.moveTo(, );

ctx.lineTo(, );

ctx.lineTo(, );

ctx.lineTo(, );

ctx.stroke();

Show the path

Change the lineDashOffset value to see how this affects how the path is drawn on the <canvas>.