Set the miter limit ratio

ctx.lineWidth = ;

ctx.miterLimit = ;

ctx.beginPath();

ctx.moveTo(, );

ctx.lineTo(, );

ctx.lineTo(, );

ctx.lineTo(, );

ctx.stroke();

Show the path

Change the miterLimit value to see how this affects how the path is drawn on the <canvas>. To highlight the difference, increase the lineWidth and move the lines until two of the lines are joined at a very small angle and the miter becomes a bevel.