Set the line cap style

ctx.lineWidth = ;

ctx.lineCap = ;

ctx.beginPath();

ctx.moveTo(, );

ctx.lineTo(, );

ctx.lineTo(, );

ctx.lineTo(, );

ctx.stroke();

Show the path

Change the lineCap value to see how this affects how the path is drawn on the <canvas>. To highlight the differences, increase the lineWidth and show the path, and then focus on the two ends of the path.