This uses the newer addition to canvas from the canvas v5 specification - native dotted and dashed lines. As browsers add support you will be able to use the option in those too but initially it's only supported in Chrome.
obj.Set('background.grid.dashed', true); obj.Set('background.grid.dotted', true);