canvas change size js code example
Example 1: js set canvas size
canvas.width = 300;
// or, if you only have the context
ctx.canvas.width = 300;
Example 2: js change canvas resolution
canvasElement.width = 1920;
canvasElement.height = 1080;
// note, canvasElement.style.width != canvasElement.width
// cE.style.width is the size of the canvas and cE.width is it's resolution