JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="c"></canvas>
JavaScript
var text = "This is the canvas M";
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
ctx.font = "24px Arial";
ctx.lineJoin = 'round'; //ADD THIS LINE
ctx.miterLimit = 2; //& THIS LINE
ctx.lineWidth = 4;
ctx.strokeStyle = "black";
ctx.strokeText(text, 5, 30);
ctx.fillStyle = "white";
ctx.fillText(text, 5, 30);