This property sets the current line thickness. Values must be positive numbers. By default this value is set to 1.0 units.
The line width is the thickness of the stroke centered on the given path. In other words, the area that’s drawn extends to half the line width on either side of the path. Because canvas coordinates do not directly reference pixels, special care must be taken to obtain crisp horizontal and vertical lines.
In the example below, 10 straight lines are drawn with increasing line widths. The line on the far left is 1.0 units wide. However, the leftmost and all other odd-integer-width thickness lines do not appear crisp, because of the path’s positioning.


        <title>Canvas tutorial</title>
            function draw(){
                var ctx = document.getElementById('canvas').getContext('2d');
                for (var i = 0; i < 10; i++) {
                    ctx.lineWidth = 1 + i;
                    ctx.moveTo(5 + i * 14, 5);
                    ctx.lineTo(5 + i * 14, 140);
    <body onload="draw();">
        <canvas id="canvas" width="200" height="200">