Canvas reference: The getLineDash function

The getLineDash function is used to get the current style (dash length and spacing etc) of the linedash

The getLineDash function is used to retrieve the current lineDash setting. It returns the same array that you set using the associated setLineDash function.


An example

<script>
    window.onload = function ()
    {
        var canvas  = document.getElementById("cvs");
        var context = canvas.getContext('2d');

        context.setLineDash([3,6]);
        context.beginPath();
        context.arc(125,125,50,0,2 * Math.PI, false);
        context.stroke();
        
        alert(context.getLineDash());
    }
</script>

See also: